커뮤니티
문의드립니다
2017-06-09 11:03:14
132
글번호 110270
안녕하세요 문의합니다
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true);
Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true);
if MarketPosition <= 0 and Bxcond == false and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
}
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
}
if MarketPosition == 1 Then{
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
}
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
}
if MarketPosition == -1 then{
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then{
ExitShort("sx");
}
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
위 로직을 운영하다보면 이상한 것이 하나가 있습니다
최초 진입후(value50 > value51 and mav17[1] < mav17)
진입청산 bl, bp, bx 나오면 실행이 중지되는 로직입니다
그런데 최초진입후 진입청산( bl, bp, bx)하였는데 또다시 최초진입(가끔)이 발생하고 있습니다
90%는 정상적으로 동작하지만 5%가 이상하게 최초진입 청산후 최초진입 구간에서 발생합니다
다시말씀드리면 최초진입(value50 >value51 and mav17[1] < mav17) 했으면 반드시 청산하고(bl, bp, bx) 진입금지하고, 다음번 (value50 >value51 and mav17[1] < mav17)나오면 진입하는 식으로 수정하여 주세요
한가지 최초진입후 진입청산( bl, bp, bx)하였는데 또다시 최초진입(가끔)이 발생합니다 어디가 문제인지 수정하여 주시면 고맙겠습니다
두가지 당일 청산식 넣어주세요(input : 에 넣어주세요 시간을 조정하여 사용하도록 하겠습니다)
세 번째 진입청산 문의합니다
b에서 진입한 것을 어떤식(00)으로
bb1에서 진입한 것을 어떤식(00)으로
bb2에서 진입한 것을 어떤식(00)으로 별도로 청산이 가능한지요
감사합니다
답변 1
예스스탁 예스스탁 답변
2017-06-09 11:32:22
안녕하세요
예스스탁입니다.
1.2
해당식 적용해 보았지만 올려주신 내용과 같은 신호가 보이지 않는데
해외선물이거나 국내선물 야간장까지 포함한 차트에 적용하시면
청산의 날짜 판단(ExitDate(1) == sdate) 때문에 해당 내용이 발생할 수 있습니다.
해당 부분과 당일청산 추가해 수정해 올려드립니다.
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
input : 당일청산시간(050000);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
var : Tcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
if Bdate != Bdate[1] then
{
Tcond = True;
BXcond = false;
SXcond = false;
}
if stime == 당일청산시간 or (stime > 당일청산시간 and stime[1] < 당일청산시간) Then
Tcond = false;
if TotalTrades > TotalTrades[1] then{
BXcond = false;
SXcond = false;
if (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true) Then
BXcond = true;
if (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true) Then
SXcond = true;
}
if MarketPosition <= 0 and
Bxcond == false and Tcond == true and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
}
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
}
if MarketPosition == 1 Then{
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
Sxcond == false and Tcond == true and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
}
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
}
if MarketPosition == -1 then{
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then{
ExitShort("sx");
}
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
3
청산함수의 4번째 매개변수가 진입명입니다.
진입명을 지정하면 특정 진입명만 청산하게 할수 있습니다.
if MarketPosition == 1 Then{
if 조건1 Then
exitlong("bx1",OnClose,def,"b");
if 조건2 Then
exitlong("bx1",OnClose,def,"bb1");
if 조건3 Then
exitlong("bx1",OnClose,def,"bb2");
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 안녕하세요 문의합니다
input : Period3(3),Period6(6),Period9(5),Period10(10),Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(10),익절틱수(20),손절틱수(10);
Input : Period(12),sigPeriod(9);
Input : Period50(50), maPeriod51(51);
input : Period33(12),sigPeriod34(9),Period55(50), maPeriod56(51);
var : mav3(0),mav6(0),mav9(0),mav10(0),mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0),SROC(0),SROCsig(0),SROC2(0),SROCsig2(0),Bxcond(false),Sxcond(false);
mav11 = ma(c, Period11);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
value1 = TRIX(Period);
value2 = ema(value1, sigPeriod);
value50 = SONAR(Period50);
value51 = ema(value50, maPeriod51);
value3 = TRIX(Period33);
value4 = ema(value3, sigPeriod34);
value52 = SONAR(Period55);
value53 = ema(value52, maPeriod56);
Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true);
Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true);
if MarketPosition <= 0 and Bxcond == false and
(value50 > value51 and mav17[1] < mav17) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[1] < mav18 and CurrentContracts < 2 Then
buy("bb1",OnClose,def,1);
}
if MarketPosition == 1 Then{
if mav17[1] < mav17 and mav18[3] >= mav18[2] and mav18[2] <= mav18[1] and mav18[1] < mav18 and CurrentContracts < 3 Then
buy("bb2",OnClose,def,1);
}
if MarketPosition == 1 Then{
if (CrossDown(value1,value2)) or (CrossDown(value50, value51)) or(CrossDown(value3,value4)) or (CrossDown(value52, value53)) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
(value50 < value51 and mav17[1] > mav17) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[1] > mav18 and CurrentContracts < 2 Then
sell("ss1",OnClose,def,1);
}
if MarketPosition == -1 then{
if mav17[1] > mav17 and mav18[3] <= mav18[2] and mav18[2] >= mav18[1] and mav18[1] > mav18 and CurrentContracts < 3 Then
sell("ss2",OnClose,def,1);
}
if MarketPosition == -1 then{
if (crossup(value1,value2)) or (CrossUP(value50, value51)) or (crossup(value3,value4)) or (crossup(value52,value53)) Then{
ExitShort("sx");
}
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
위 로직을 운영하다보면 이상한 것이 하나가 있습니다
최초 진입후(value50 > value51 and mav17[1] < mav17)
진입청산 bl, bp, bx 나오면 실행이 중지되는 로직입니다
그런데 최초진입후 진입청산( bl, bp, bx)하였는데 또다시 최초진입(가끔)이 발생하고 있습니다
90%는 정상적으로 동작하지만 5%가 이상하게 최초진입 청산후 최초진입 구간에서 발생합니다
다시말씀드리면 최초진입(value50 >value51 and mav17[1] < mav17) 했으면 반드시 청산하고(bl, bp, bx) 진입금지하고, 다음번 (value50 >value51 and mav17[1] < mav17)나오면 진입하는 식으로 수정하여 주세요
한가지 최초진입후 진입청산( bl, bp, bx)하였는데 또다시 최초진입(가끔)이 발생합니다 어디가 문제인지 수정하여 주시면 고맙겠습니다
두가지 당일 청산식 넣어주세요(input : 에 넣어주세요 시간을 조정하여 사용하도록 하겠습니다)
세 번째 진입청산 문의합니다
b에서 진입한 것을 어떤식(00)으로
bb1에서 진입한 것을 어떤식(00)으로
bb2에서 진입한 것을 어떤식(00)으로 별도로 청산이 가능한지요
감사합니다
다음글
이전글