커뮤니티

수식 확인부탁합니다

프로필 이미지
회원
2017-03-21 17:28:36
122
글번호 108060
답변완료
52504 확인 부탁드립니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-03-22 12:29:52

안녕하세요 예스스탁입니다. 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 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } 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 Then exitlong(); if MarketPosition == -1 Then ExitShort(); } 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("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); } 즐거운 하루되세요 > 골든키 님이 쓴 글입니다. > 제목 : 수식 확인부탁합니다 > 52504 확인 부탁드립니다