커뮤니티

수정부탁드립니다

프로필 이미지
회원
2017-03-23 17:54:24
138
글번호 108112
답변완료
수고 많으십니다. 수식을 적용해보니 per1(18)수식에 손절이 작동이 안돼서 SetStopLoss(PriceScale*15,PointStop);를 추가적용한결과 #,그림파일1 와같이 per2(9)의 매매시간 종료전에 per1(18)에(1)번이 매도진입할경우 손절이 작동하지 않습니다. #,또한 그림3과 같이 per2()의 매매시간종료전에 per1()에 매수진입(b12)할경우 (1)번청산과 (2)번 청산이 이 작동하지 앟습니다. #,그런데 그림2와같이 per2(9)의 매매시간이 종료된후에 per1(18)이 매도진입(s12)할경우는 그림과 같이 손절이 정상 작동합니다,원인 확인 부탁합니다. #,또한 그림1에서보면 s22매도진입후 손절(s12)이정상 작동되고 장종료시간(12;50)에 정상으로 (ExitShortNo2)가 표기되는데(그림3도 정상표기) #,그림2에서 장종료시간에 (ExitShdrtNo2)는 왜 표기가 안되는지요, 수정부탁드립니다. #, 종합해보면 per2(9)의 매매시간 종료전에 per1(18)진입하면 손절,청산이 전혀작동을 하지않고 per2(9) 매매시간 종료후에 per1(18)이 진입하면 정상작동 하는데 원인 확인후 수정 부탁 드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-03-23 10:26:59

안녕하세요 예스스탁입니다. 식을 수정했습니다. 수식안에 모든 청산이 있으므로 강제청산은 사용하면 안됩니다. input : Per1(18),시작시간1(103000),종료시간1(235000); input : Per2(9),시작시간2(70000),종료시간2(125000); var : Tcond1(false),Tcond2(false),entry1(false),entry2(false); Var : S1(0),S2(1),S3(1),S4(1),T1(0); if (시작시간1 == 0 and sdate != sdate[1]) or (시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1))) Then{ Tcond1 = true; entry1 = false;; } if (종료시간1 == 0 and sdate != sdate[1]) or (종료시간1 > 0 and (stime == 종료시간1 or (stime > 종료시간1 and stime[1] < 종료시간1))) Then{ Tcond1 = false; if MarketPosition == 1 and (IsEntryName("b11") or IsEntryName("b12")) Then ExitLong("Dbx1"); if MarketPosition == -1 and (IsEntryName("s11") or IsEntryName("s12")) Then ExitShort("Dsx1"); } if (시작시간2 == 0 and sdate != sdate[1]) or (시작시간2 > 0 and (stime == 시작시간2 or (stime > 시작시간2 and stime[1] < 시작시간2))) Then{ Tcond2 = true; entry2 = false; } if (종료시간2 == 0 and sdate != sdate[1]) or (종료시간2 > 0 and (stime == 종료시간2 or (stime > 종료시간2 and stime[1] < 종료시간2))) Then{ Tcond2 = false; if MarketPosition == 1 and (IsEntryName("b21") or IsEntryName("b22")) Then ExitLong("Dbx2"); if MarketPosition == -1 and (IsEntryName("s21") or IsEntryName("s22")) Then ExitShort("Dsx2"); } if Tcond1 == true and CurrentContracts > CurrentContracts[1] and (LatestEntryName(0) == "b11" or LatestEntryName(0) == "b12" or LatestEntryName(0) == "s11" or LatestEntryName(0) == "s12") Then entry1 = true; if Tcond2 == true and CurrentContracts > CurrentContracts[1] and (LatestEntryName(0) == "b21" or LatestEntryName(0) == "b22" or LatestEntryName(0) == "s21" or LatestEntryName(0) == "s22") Then entry2 = true; S1 = (dayhigh(0)+daylow(0))/2; S2 = (dayhigh(1)+daylow(1))/2; S3 = dayhigh(1); S4 = daylow(1); var1 = dayclose(1)+abs(S3-S4)*(Per1/100); var2 = dayclose(1)-abs(S3-S4)*(Per1/100); var3 = dayclose(1)+abs(S3-S4)*(Per2/100); var4 = dayclose(1)-abs(S3-S4)*(Per2/100); if MarketPosition == 0 and Tcond1 == true and entry1 == false Then{ if NextBarOpen <= var2 Then buy("b11",AtStop,var2,2); Else buy("b12",Atlimit,var2,2); if NextBarOpen >= var1 Then sell("s11",AtStop,var1,2); Else sell("s12",Atlimit,var1,2); } if MarketPosition == 0 and Tcond2 == true and entry2 == false Then{ if NextBarOpen <= var4 Then buy("b21",AtStop,var4,1); Else buy("b22",Atlimit,var4,1); if NextBarOpen >= var3 Then sell("s21",AtStop,var3,1); Else sell("s22",Atlimit,var3,1); } if MarketPosition == 1 and (IsEntryName("b11") or IsEntryName("b12")) Then{ exitlong("bl1",AtStop,EntryPrice-PriceScale*20); exitlong("bx1",atlimit,EntryPrice+PriceScale*20,"",1,1); exitlong("bx2",atlimit,var1,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bx3",AtStop,var2,"",1,1); } if MarketPosition == 1 and (IsEntryName("b21") or IsEntryName("b22")) Then{ exitlong("bl2",AtStop,EntryPrice-PriceScale*7); exitlong("bx22",atlimit,var3); } if MarketPosition == -1 and (IsEntryName("s11") or IsEntryName("s12")) Then{ ExitShort("sl1",AtStop,EntryPrice+PriceScale*20); ExitShort("sx1",atlimit,EntryPrice-PriceScale*20,"",1,1); ExitShort("sx2",atlimit,var2,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx3",AtStop,var1,"",1,1); } if MarketPosition == -1 and (IsEntryName("s21") or IsEntryName("s22")) Then{ ExitShort("sl2",AtStop,EntryPrice+PriceScale*7); ExitShort("sx22",atlimit,var4); } 즐거운 하루되세요 > 골든키 님이 쓴 글입니다. > 제목 : 수정부탁드립니다 > 수고 많으십니다. 52519 수식을 적용해보니 per1(18)수식에 손절이 작동이 안돼서 SetStopLoss(PriceScale*15,PointStop);를 추가적용한결과 #,그림파일1 와같이 per2(9)의 매매시간 종료전에 per1(18)에(1)번이 매도진입할경우 손절이 작동하지 않습니다. #,또한 그림3과 같이 per2()의 매매시간종료전에 per1()에 매수진입(b12)할경우 (1)번청산과 (2)번 청산이 이 작동하지 &#50527;습니다. #,그런데 그림2와같이 per2(9)의 매매시간이 종료된후에 per1(18)이 매도진입(s12)할경우는 그림과 같이 손절이 정상 작동합니다,원인 확인 부탁합니다. #,또한 그림1에서보면 s22매도진입후 손절(s12)이정상 작동되고 장종료시간(12;50)에 정상으로 (ExitShortNo2)가 표기되는데(그림3도 정상표기) #,그림2에서 장종료시간에 (ExitShdrtNo2)는 왜 표기가 안되는지요, 수정부탁드립니다. #, 종합해보면 per2(9)의 매매시간 종료전에 per1(18)진입하면 손절,청산이 전혀작동을 하지않고 per2(9) 매매시간 종료후에 per1(18)이 진입하면 정상작동 하는데 원인 확인후 수정 부탁 드립니다. "여러번 수정 의뢰에도 친절히 답변주셔서 진심 감사드리며 마지막 수정이라 기원하면서 부탁합니다" = 언제나 늘 감사합니다 =