커뮤니티

수정부탁드립니다

프로필 이미지
회원
2017-04-20 20:58:51
197
글번호 108967
답변완료
#,그림파일3 에서 1번에 매도진입(S3) 1차청산은(sx1)정상작동(+27)하는데 2차청산은 수식대로 2번라인(per2)에서 청산되어야 하는데 3번(per1)sx2 에서 미리 청산되는 현상이 발생합니 다, per1과 중복혼용되서 나타나는 현상이 아닌지..점검후 수정 부탁드립니다. #, 청산조절수식도 per1,per2를 각기 따로 적용해서 조절하면 좋겠습니다 $,언제나 늘 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-04-20 15:05:01

안녕하세요 예스스탁입니다. 식을 수정했습니다. input : Per1(18.2),시작시간1(103000),종료시간1(230000),당일최대진입횟수1(7); input : Per2(38.2),시작시간2(103000),종료시간2(30000),당일최대진입횟수2(3); input : x(5),x1(5); Var : S1(0),S2(1),S3(1),S4(1); var : Tcond1(false),entry1(0); var : Tcond2(false),entry2(0); if 시작시간1 == 0 and sdate != sdate[1] Then{ Tcond1 = true; entry1 = 0; } if 시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1)) Then{ Tcond1 = true; entry1 = 0; } if 종료시간1 == 0 and sdate != sdate[1] Then{ Tcond1 = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if 종료시간1 > 0 and (stime == 종료시간1 or (stime > 종료시간1 and stime[1] < 종료시간1)) Then{ Tcond1 = false; if (LatestEntryName(0) == "b1" or LatestEntryName(0) == "b2" or LatestEntryName(0) == "s1" or LatestEntryName(0) == "s2" or LatestEntryName(0) == "b11" or LatestEntryName(0) == "b22" or LatestEntryName(0) == "s11" or LatestEntryName(0) == "s22") Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } } if 시작시간2 == 0 and sdate != sdate[1] Then{ Tcond2 = true; entry2 = 0; } if 시작시간2 > 0 and (stime == 시작시간2 or (stime > 시작시간2 and stime[1] < 시작시간2)) Then{ Tcond2 = true; entry2 = 0; } if 종료시간2 == 0 and sdate != sdate[1] Then{ Tcond2 = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if 종료시간2 > 0 and (stime == 종료시간2 or (stime > 종료시간2 and stime[1] < 종료시간2)) Then{ Tcond2 = false; if (LatestEntryName(0) == "b3" or LatestEntryName(0) == "b4" or LatestEntryName(0) == "s3" or LatestEntryName(0) == "s4" or LatestEntryName(0) == "b33" or LatestEntryName(0) == "b44" or LatestEntryName(0) == "s33" or LatestEntryName(0) == "s44") Then{ if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } } 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 Tcond1 == true then{ if CurrentContracts > CurrentContracts[1] and (LatestEntryName(0) == "b1" or LatestEntryName(0) == "b2" or LatestEntryName(0) == "s1" or LatestEntryName(0) == "s2" or LatestEntryName(0) == "b11" or LatestEntryName(0) == "b22" or LatestEntryName(0) == "s11" or LatestEntryName(0) == "s22") Then entry1 = entry1+1; if MarketPosition == 0 and entry1 < 당일최대진입횟수1 Then{ if NextBarOpen <= var2 Then buy("b1",AtStop,var2,2); Else buy("b2",Atlimit,var2,2); if NextBarOpen >= var1 Then sell("s1",AtStop,var1,2); Else sell("s2",Atlimit,var1,2); } if MarketPosition == 0 and entry1 >= 1 and entry1 < 당일최대진입횟수1 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{ if NextBarOpen <= var2 Then buy("b11",AtStop,var2,2); Else buy("b22",Atlimit,var2,2); if NextBarOpen >= var1 Then sell("s11",AtStop,var1,2); Else sell("s22",Atlimit,var1,2); } } if Tcond2 == true then{ if CurrentContracts > CurrentContracts[1] and (LatestEntryName(0) == "b3" or LatestEntryName(0) == "b4" or LatestEntryName(0) == "s3" or LatestEntryName(0) == "s4" or LatestEntryName(0) == "b33" or LatestEntryName(0) == "b44" or LatestEntryName(0) == "s33" or LatestEntryName(0) == "s44") Then entry2 = entry2+1; if MarketPosition == 0 and entry2 < 당일최대진입횟수2 Then{ if NextBarOpen <= var4 Then buy("b3",AtStop,var4,2); Else buy("b4",Atlimit,var4,2); if NextBarOpen >= var3 Then sell("s3",AtStop,var3,2); Else sell("s4",Atlimit,var3,2); } if MarketPosition == 0 and entry2 >= 1 and entry2 < 당일최대진입횟수2 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{ if NextBarOpen <= var4 Then buy("b33",AtStop,var4,2); Else buy("b44",Atlimit,var4,2); if NextBarOpen >= var3 Then sell("s33",AtStop,var3,2); Else sell("s44",Atlimit,var3,2); } } if MarketPosition == 1 Then{ if (LatestEntryName(0) == "b1" or LatestEntryName(0) == "b2" or LatestEntryName(0) == "b11" or LatestEntryName(0) == "b22") Then{ if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*5 Then exitlong("bx",AtStop,EntryPrice+x*PriceScale); exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1); exitlong("bx2",atlimit,var1,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bx3",AtStop,EntryPrice+x1*PriceScale,"",1,1); } if (LatestEntryName(0) == "b3" or LatestEntryName(0) == "b4" or LatestEntryName(0) == "b33" or LatestEntryName(0) == "b44") Then{ if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*5 Then exitlong("bxx",AtStop,EntryPrice+x*PriceScale); exitlong("bxx1",atlimit,EntryPrice+PriceScale*27,"",1,1); exitlong("bxx2",atlimit,var3,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bxx3",AtStop,EntryPrice+x1*PriceScale,"",1,1); } } if MarketPosition == -1 Then{ if (LatestEntryName(0) == "s1" or LatestEntryName(0) == "s2" or LatestEntryName(0) == "s11" or LatestEntryName(0) == "s22") Then{ if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*5 Then ExitShort("sx",AtStop,EntryPrice-x*PriceScale); ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1); ExitShort("sx2",atlimit,var2,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx3",AtStop,EntryPrice-x1*PriceScale,"",1,1); } if (LatestEntryName(0) == "s3" or LatestEntryName(0) == "s4" or LatestEntryName(0) == "s33" or LatestEntryName(0) == "s44") Then{ if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*5 Then ExitShort("sxx",AtStop,EntryPrice-x*PriceScale); ExitShort("sxx1",atlimit,EntryPrice-PriceScale*27,"",1,1); ExitShort("sxx2",atlimit,var4,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sxx3",AtStop,EntryPrice-x1*PriceScale,"",1,1); } } SetStopLoss(PriceScale*15,PointStop); 즐거운 하루되세요 > 골든키 님이 쓴 글입니다. > 제목 : 수정부탁드립니다 > 안녕하세요 52942 수식에서 #,그림파일1과같이 per1(18)은 정상인데 반해 per2(38.2)진입횟수 조절수식은(3)회로 지정 됐는데 실제는 그림파일2 와 같이 다수로 진입하는 현상이 발생합니다,임의로 횟수조절를 해봐도 적용되지 않습니다, 점검,수정 부탁드립니다. #,그림파일3 에서 1번에 매도진입(S3) 1차청산은(sx1)정상작동(+27)하는데 2차청산은 수식대로 2번라인(per2)에서 청산되어야 하는데 3번(per1)sx2 에서 미리 청산되는 현상이 발생합니 다, per1과 중복혼용되서 나타나는 현상이 아닌지..점검후 수정 부탁드립니다. #, 청산조절수식도 per1,per2를 각기 따로 적용해서 조절하면 좋겠습니다 $,언제나 늘 감사합니다.