커뮤니티
수정 부탁 드립니다
2013-09-09 01:08:34
114
글번호 67325
수고 많으십니다
바로 밑에 식은 매수식이구요 매수식은 정상으로 돌아 가는거 같은데
매수식 아래레 매도식을 넣어 놨습니다 매도식은
y,x,q,w가 있는 맨 아래쪽 수식들이 반영이 되질 않는거 같습니다
보시고 한번 수정 부탁 드립니다
그리고 매수 매도 둘다 수식에 보시면 최초 매수쪽과 최초 매도 쪽
그리고 끝쪽에 보시면 z와 n값이 and로 묶여져 있습니다 둘중 하나만 만족해도
되도록 하고 싶습니다
특히 이쪽 부분
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
(q or w) and (n or z) 이렇게 되야 하거든요 요것도 같이 좀 부탁 드립니다
input : StartTime(90200);
input : RSVValue(60);
input : LossPoint(0.65),재매수횟수(10),재매수청산횟수(10),ProfitPoint(10);
input : 청산양봉갯수(20),청산음봉갯수(3);
input : z(1.35);
input : N(1.75);
input : y(3.7);
input : x(3.7);
input : q(3.7);
input : w(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(30),RSIvalue2(50);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(7);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(22);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(29);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(60);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(56);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(3);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav5,BarsSinceExit(1)) >= 1)) and
C <= DayLow+N and
MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& RSV > RSVValue
&& C > MAv5
&& C < dayopen+z
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv5 Then
Exitlong("매수청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv6 and
countif(C < mav5,BarsSinceExit(1)) < 1 Then
buy("재매수");
}*/
if MarketPosition == 1 and ReEL < 재매수청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV < RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C <= DayLow+N and
C < dayopen+z Then
ExitLong("매수청산4");
}
if MarketPosition == 0 and IsExitName("매수청산4",1) == true and count > 0 and RSIV > RSIvalue2 and
rebuy < 재매수횟수 and C > MAv6 and C > MAv5 and close > open and countif(C < mav5,BarsSinceExit(1)) < 1 and C <= DayLow+N and
C < dayopen+z then
buy("재매수");
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
input : StartTime(90200);
input : RSVValue(32);
input : LossPoint(0.6),재매도횟수(10),재매도청산횟수(10),ProfitPoint(2.5);
input : 청산양봉갯수(3),청산음봉갯수(20);
input : z(1.35);
input : N(-1.7);
input : y(3.7);
input : X(0.5);
input : q(3.7);
input : w(-3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(60),RSIvalue2(42);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(10);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(12);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(15);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(18);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(47);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(6);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav5,BarsSinceExit(1)) >= 1)) and
C >= dayhigh+N and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
RSV < RSVValue and
C < MAv5 and
C > dayopen-z
Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv5 Then
ExitShort("매도청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond2 == true,진입음봉갯수) == 진입음봉갯수 ) and
reSell < 재매도횟수 and C < MAv6 and
countif(C > mav5,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}*/
if MarketPosition == -1 and ReES < 재매도청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV > RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C >= dayhigh+N and C > dayopen-z Then
Exitshort("매도청산4");
}
if MarketPosition == 0 and IsExitName("매도청산4",1) == true and count > 0 and RSIV < RSIvalue2 and
reSell < 재매도횟수 and C < MAv6 and C < MAv5 and close < open and countif(C > mav5,BarsSinceExit(1)) < 1
and C >= dayhigh+N and C > dayopen-z then
sell("재매도");
if MarketPosition == -1 and C >= dayhigh+q and C > dayopen-w and C <= dayhigh+N and C < dayopen-z Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
답변 2
예스스탁 예스스탁 답변
2013-09-09 14:19:24
안녕하세요
예스스탁입니다.
해당 청산식을 아래와 같이 수정하시면 됩니다.
1.
매수식
if MarketPosition == 1 and ((C <= DayLow+q or C < dayopen+w) and (C >= DayLow+N or C > dayopen+z)) Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
2
매도식
if MarketPosition == -1 and ((C >= dayhigh+q or C > dayopen-w) and (C <= dayhigh+N or C < dayopen-z)) Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
즐거운 하루되세요
> 난정욱 님이 쓴 글입니다.
> 제목 : 수정 부탁 드립니다
> 수고 많으십니다
바로 밑에 식은 매수식이구요 매수식은 정상으로 돌아 가는거 같은데
매수식 아래레 매도식을 넣어 놨습니다 매도식은
y,x,q,w가 있는 맨 아래쪽 수식들이 반영이 되질 않는거 같습니다
보시고 한번 수정 부탁 드립니다
그리고 매수 매도 둘다 수식에 보시면 최초 매수쪽과 최초 매도 쪽
그리고 끝쪽에 보시면 z와 n값이 and로 묶여져 있습니다 둘중 하나만 만족해도
되도록 하고 싶습니다
특히 이쪽 부분
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
(q or w) and (n or z) 이렇게 되야 하거든요 요것도 같이 좀 부탁 드립니다
input : StartTime(90200);
input : RSVValue(60);
input : LossPoint(0.65),재매수횟수(10),재매수청산횟수(10),ProfitPoint(10);
input : 청산양봉갯수(20),청산음봉갯수(3);
input : z(1.35);
input : N(1.75);
input : y(3.7);
input : x(3.7);
input : q(3.7);
input : w(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(30),RSIvalue2(50);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(7);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(22);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(29);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(60);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(56);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(3);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav5,BarsSinceExit(1)) >= 1)) and
C <= DayLow+N and
MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& RSV > RSVValue
&& C > MAv5
&& C < dayopen+z
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv5 Then
Exitlong("매수청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv6 and
countif(C < mav5,BarsSinceExit(1)) < 1 Then
buy("재매수");
}*/
if MarketPosition == 1 and ReEL < 재매수청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV < RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C <= DayLow+N and
C < dayopen+z Then
ExitLong("매수청산4");
}
if MarketPosition == 0 and IsExitName("매수청산4",1) == true and count > 0 and RSIV > RSIvalue2 and
rebuy < 재매수횟수 and C > MAv6 and C > MAv5 and close > open and countif(C < mav5,BarsSinceExit(1)) < 1 and C <= DayLow+N and
C < dayopen+z then
buy("재매수");
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
input : StartTime(90200);
input : RSVValue(32);
input : LossPoint(0.6),재매도횟수(10),재매도청산횟수(10),ProfitPoint(2.5);
input : 청산양봉갯수(3),청산음봉갯수(20);
input : z(1.35);
input : N(-1.7);
input : y(3.7);
input : X(0.5);
input : q(3.7);
input : w(-3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(60),RSIvalue2(42);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(10);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(12);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(15);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(18);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(47);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(6);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav5,BarsSinceExit(1)) >= 1)) and
C >= dayhigh+N and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
RSV < RSVValue and
C < MAv5 and
C > dayopen-z
Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv5 Then
ExitShort("매도청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond2 == true,진입음봉갯수) == 진입음봉갯수 ) and
reSell < 재매도횟수 and C < MAv6 and
countif(C > mav5,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}*/
if MarketPosition == -1 and ReES < 재매도청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV > RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C >= dayhigh+N and C > dayopen-z Then
Exitshort("매도청산4");
}
if MarketPosition == 0 and IsExitName("매도청산4",1) == true and count > 0 and RSIV < RSIvalue2 and
reSell < 재매도횟수 and C < MAv6 and C < MAv5 and close < open and countif(C > mav5,BarsSinceExit(1)) < 1
and C >= dayhigh+N and C > dayopen-z then
sell("재매도");
if MarketPosition == -1 and C >= dayhigh+q and C > dayopen-w and C <= dayhigh+N and C < dayopen-z Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
예스스탁 예스스탁 답변
2013-09-09 15:02:54
안녕하세요
예스스탁입니다.
1,
기존 매수청산식을 반대로 작성한 매도청산식입니다.
if MarketPosition == -1 and C >= dayhigh-q and C > dayopen-w and C <= dayhigh-N and C < dayopen-z Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
2. (q and W) or ( n and z) 로 작성된 식입니다.
if MarketPosition == 1 and ((C <= DayLow+q and C < dayopen+w) or (C >= DayLow+N and C > dayopen+z)) Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
if MarketPosition == -1 and ((C >= dayhigh-q and C > dayopen-w) or (C <= dayhigh-N and C < dayopen-z)) Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
즐거운 하루되세요
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 수정 부탁 드립니다
> 안녕하세요
예스스탁입니다.
해당 청산식을 아래와 같이 수정하시면 됩니다.
1.
매수식
if MarketPosition == 1 and ((C <= DayLow+q or C < dayopen+w) and (C >= DayLow+N or C > dayopen+z)) Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
2
매도식
if MarketPosition == -1 and ((C >= dayhigh+q or C > dayopen-w) and (C <= dayhigh+N or C < dayopen-z)) Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
즐거운 하루되세요
> 난정욱 님이 쓴 글입니다.
> 제목 : 수정 부탁 드립니다
> 수고 많으십니다
바로 밑에 식은 매수식이구요 매수식은 정상으로 돌아 가는거 같은데
매수식 아래레 매도식을 넣어 놨습니다 매도식은
y,x,q,w가 있는 맨 아래쪽 수식들이 반영이 되질 않는거 같습니다
보시고 한번 수정 부탁 드립니다
그리고 매수 매도 둘다 수식에 보시면 최초 매수쪽과 최초 매도 쪽
그리고 끝쪽에 보시면 z와 n값이 and로 묶여져 있습니다 둘중 하나만 만족해도
되도록 하고 싶습니다
특히 이쪽 부분
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
(q or w) and (n or z) 이렇게 되야 하거든요 요것도 같이 좀 부탁 드립니다
input : StartTime(90200);
input : RSVValue(60);
input : LossPoint(0.65),재매수횟수(10),재매수청산횟수(10),ProfitPoint(10);
input : 청산양봉갯수(20),청산음봉갯수(3);
input : z(1.35);
input : N(1.75);
input : y(3.7);
input : x(3.7);
input : q(3.7);
input : w(3.7);
var : cnt(0),count(0),rebuy(0),ReEL(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(30),RSIvalue2(50);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(7);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(22);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(29);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(60);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(56);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(3);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매수") == true Then{
Rebuy = 0;
ReEL = 0;
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] and IsEntryName("재매수") == true Then
Rebuy = Rebuy+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매수청산4",1) == true Then
ReEL = ReEL+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition <= 0 and
(count == 0 or
(count > 0 and IsExitName("매수청산4",1) == false) or
(count > 0 and countif(C < mav5,BarsSinceExit(1)) >= 1)) and
C <= DayLow+N and
MAv1 > MAv2
&& MAv2 > MAv3
&& MAv3 > MAv4
&& RSV > RSVValue
&& C > MAv5
&& C < dayopen+z
Then
{
Buy("최초매수", OnClose, DEF);
}
if MarketPosition == 1 Then{
ExitLong("매수청산2",AtStop,EntryPrice-Losspoint);
ExitLong("매수청산3",AtLimit,EntryPrice+Profitpoint);
}
if MarketPosition == 1 and C < MAv5 Then
Exitlong("매수청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매수",1) == true or IsEntryName("재매수",1) == true) and
IsExitName("매수청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond1 == true,진입양봉갯수) == 진입양봉갯수 ) and
rebuy < 재매수횟수 and C > MAv6 and
countif(C < mav5,BarsSinceExit(1)) < 1 Then
buy("재매수");
}*/
if MarketPosition == 1 and ReEL < 재매수청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV < RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C <= DayLow+N and
C < dayopen+z Then
ExitLong("매수청산4");
}
if MarketPosition == 0 and IsExitName("매수청산4",1) == true and count > 0 and RSIV > RSIvalue2 and
rebuy < 재매수횟수 and C > MAv6 and C > MAv5 and close > open and countif(C < mav5,BarsSinceExit(1)) < 1 and C <= DayLow+N and
C < dayopen+z then
buy("재매수");
if MarketPosition == 1 and C <= DayLow+q and C < dayopen+w and C >= DayLow+N and C > dayopen+z Then{
if highest(h,BarsSinceEntry) >= EntryPrice+Y Then
ExitLong("청산7",AtStop,highest(H,BarsSinceEntry)-x);
}
input : StartTime(90200);
input : RSVValue(32);
input : LossPoint(0.6),재매도횟수(10),재매도청산횟수(10),ProfitPoint(2.5);
input : 청산양봉갯수(3),청산음봉갯수(20);
input : z(1.35);
input : N(-1.7);
input : y(3.7);
input : X(0.5);
input : q(3.7);
input : w(-3.7);
var : cnt(0),count(0),resell(0),ReES(0);
var : cond1(false),cond2(false);
input : RSIP(9),RSIvalue1(60),RSIvalue2(42);
var : RSIV(0);
RSIV = RSI(RSIP);
//ma1
input : maPeriod1(10);
var : MAv1(0);
MAv1 = ma(C,maPeriod1);
//ma2
input : maPeriod2(12);
var : MAv2(0);
MAv2 = ma(C,maPeriod2);
//ma3
input : maPeriod3(15);
var : MAv3(0);
MAv3 = ma(C,maPeriod3);
//ma4
input : maPeriod4(18);
var : MAv4(0);
MAv4 = ma(C,maPeriod4);
//ma5
Input : maPeriod5(47);
var : MAv5(0);
MAv5 = ma(C,maPeriod5);
//ma6
Input : maPeriod6(2);
var : MAv6(0);
MAv6 = ma(C,maPeriod6);
//RSI
input : rsiPeriod(6);
var : RSV(0);
RSV = RSI(rsiPeriod);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
if date != date[1] Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("최초매도") == true Then{
ReSell = 0;
ReES = 0;
}
if MarketPosition == -1 and MarketPosition != MarketPosition[1] and IsEntryName("재매도") == true Then
ReSell = ReSell+1;
if BarsSinceExit(1) == 1 and MarketPosition != MarketPosition[1] and IsExitName("매도청산4",1) == true Then
ReES = ReES+1;
cond1 = C > O or (C==O and C >= C[1]);
cond2 = C < O or (C==O and C < C[1]);
if stime >= StartTime and MarketPosition >= 0 and
(count == 0 or
(count > 0 and IsExitName("매도청산4",1) == false) or
(count > 0 and countif(C > mav5,BarsSinceExit(1)) >= 1)) and
C >= dayhigh+N and
MAv1 < MAv2 and
MAv2 < MAv3 and
MAv3 < MAv4 and
RSV < RSVValue and
C < MAv5 and
C > dayopen-z
Then{
Sell("최초매도");
}
if MarketPosition == -1 Then{
ExitShort("매도청산2",AtStop,EntryPrice+Losspoint);
ExitShort("매도청산3",AtLimit,EntryPrice-Profitpoint);
}
if MarketPosition == -1 and C > MAv5 Then
ExitShort("매도청산1");
/*
if count >= 1 Then{
if MarketPosition == 0 and
(IsEntryName("최초매도",1) == true or IsEntryName("재매도",1) == true) and
IsExitName("매도청산4",1) == True and
BarsSinceExit(1) >= 3 and
(Countif(cond2 == true,진입음봉갯수) == 진입음봉갯수 ) and
reSell < 재매도횟수 and C < MAv6 and
countif(C > mav5,BarsSinceExit(1)) < 1 Then
Sell("재매도");
}*/
if MarketPosition == -1 and ReES < 재매도청산횟수 then{
if (BarsSinceEntry >= 청산양봉갯수 and Countif(cond1 == true,청산양봉갯수) == 청산양봉갯수) or RSIV > RSIvalue1 or
(BarsSinceEntry >= 청산음봉갯수 and Countif(cond2 == true,청산음봉갯수) == 청산음봉갯수) and C >= dayhigh+N and C > dayopen-z Then
Exitshort("매도청산4");
}
if MarketPosition == 0 and IsExitName("매도청산4",1) == true and count > 0 and RSIV < RSIvalue2 and
reSell < 재매도횟수 and C < MAv6 and C < MAv5 and close < open and countif(C > mav5,BarsSinceExit(1)) < 1
and C >= dayhigh+N and C > dayopen-z then
sell("재매도");
if MarketPosition == -1 and C >= dayhigh+q and C > dayopen-w and C <= dayhigh+N and C < dayopen-z Then{
if Lowest(L,BarsSinceEntry) <= EntryPrice-Y Then
ExitShort("청산7",Atstop,Lowest(L,BarsSinceEntry)+x);
}
다음글
이전글