커뮤니티

수정 부탁합니다

프로필 이미지
회원
2017-04-18 21:28:56
179
글번호 108927
답변완료
아래수식에서 #, per1과 per2 진입횟수를 각기 달리 적용하고자 진입횟수 수식추가(변수)해봤는데 per2의 신호발생이 안되거나 시작시간 적용도 불규칙합니다, 잘못된점 수정해주시면 좋겠습니다.(per1의 진입횟수 조절기능과 같이 per2도 별도조절 가능하길 원합니다) #, 또한 per2의 매매시간 적용도 조절가능하면 좋겠습니다,수정부탁합니다. $, 언제나 늘 감사합니다. input : Per1(18.2),시작시간(103000),종료시간(230000),당일최대진입횟수(7),x(5),x1(5); input : Per2(38.2),시작시간1(103000),종료시간1(30000),당일최대진입횟수1(3); Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0),Tcond1(false); if 시작시간 == 0 and sdate != sdate[1] Then{ Tcond = true; T1 = TotalTrades; } if 시작시간 > 0 and (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) Then{ Tcond = true; T1 = TotalTrades; } if 종료시간 == 0 and sdate != sdate[1] Then{ Tcond = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if 종료시간 > 0 and (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) Then{ Tcond = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if 시작시간1 == 0 and sdate != sdate[1] Then{ Tcond1 = true; } if 시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1)) Then{ Tcond1 = true; } 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 MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if MarketPosition == 0 Then entry = TotalTrades -T1; Else entry = (TotalTrades -T1)+1; 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 Tcond == true and entry < 당일최대진입횟수 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 Tcond == true and entry >= 1 and entry < 3 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 MarketPosition == 0 and Tcond1 == true and entry < 당일최대진입횟수1 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 Tcond1 == true and entry >= 1 and entry < 3 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 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 MarketPosition == -1 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); } SetStopLoss(PriceScale*15,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-04-19 17:12:57

안녕하세요 예스스탁입니다. 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 entry1 = entry1+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 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 MarketPosition == -1 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); } SetStopLoss(PriceScale*15,PointStop); 즐거운 하루되세요 > 골든키 님이 쓴 글입니다. > 제목 : 수정 부탁합니다 > 아래수식에서 #, per1과 per2 진입횟수를 각기 달리 적용하고자 진입횟수 수식추가(변수)해봤는데 per2의 신호발생이 안되거나 시작시간 적용도 불규칙합니다, 잘못된점 수정해주시면 좋겠습니다.(per1의 진입횟수 조절기능과 같이 per2도 별도조절 가능하길 원합니다) #, 또한 per2의 매매시간 적용도 조절가능하면 좋겠습니다,수정부탁합니다. $, 언제나 늘 감사합니다. input : Per1(18.2),시작시간(103000),종료시간(230000),당일최대진입횟수(7),x(5),x1(5); input : Per2(38.2),시작시간1(103000),종료시간1(30000),당일최대진입횟수1(3); Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0),Tcond1(false); if 시작시간 == 0 and sdate != sdate[1] Then{ Tcond = true; T1 = TotalTrades; } if 시작시간 > 0 and (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) Then{ Tcond = true; T1 = TotalTrades; } if 종료시간 == 0 and sdate != sdate[1] Then{ Tcond = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if 종료시간 > 0 and (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) Then{ Tcond = false; if MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if 시작시간1 == 0 and sdate != sdate[1] Then{ Tcond1 = true; } if 시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1)) Then{ Tcond1 = true; } 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 MarketPosition == 1 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } if MarketPosition == 0 Then entry = TotalTrades -T1; Else entry = (TotalTrades -T1)+1; 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 Tcond == true and entry < 당일최대진입횟수 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 Tcond == true and entry >= 1 and entry < 3 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 MarketPosition == 0 and Tcond1 == true and entry < 당일최대진입횟수1 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 Tcond1 == true and entry >= 1 and entry < 3 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 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 MarketPosition == -1 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); } SetStopLoss(PriceScale*15,PointStop);