커뮤니티

수식부탁합니다

프로필 이미지
회원
2017-04-06 20:17:42
210
글번호 108519
답변완료
안녕하세요- 아래수식에서 #,조건만족시 매수 진입후 1차청산을 못하고 진입자리로 되돌림시 진입자리에서 매수 청산 매도 진입후 1차청산을 못하고 진입자라로 되돌림시 진입자리에서 매도 청산 하는식을 추가하면 좋겠습니다.(다른조건은 기존수식과 동일 유지) #,위의 되돌림 청산이후 기존수식(추가수식포함) 조건으로 매매시간 범위내에서 3회(변수)만 연속 재 진입하는 수식 부탁합니다. input : Per1(28.2),시작시간(103000),종료시간(40000); Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0); 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 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); if MarketPosition == 0 and Tcond == true and entry < 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 == 1 Then{ exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1); exitlong("bx2",atlimit,var1,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bx3",AtStop,var2,"",1,1); } if MarketPosition == -1 Then{ ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1); ExitShort("sx2",atlimit,var2,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx3",AtStop,var1,"",1,1); } SetStopLoss(PriceScale*15,PointStop); ##,언제나 늘 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-04-07 09:42:38

안녕하세요 예스스탁입니다. 올려주신 1차청산을 못하고 진입자리로 되돌림시 진입자리에서 청산은 진입후 바로 청산이 나올수 있습니다. 매수진입후 바로 진입가와 같거나 낮은 시세가 발생하면 1차청산을 하지 않은 상황이므로 즉시 청산이 발생하게 됩니다. 즉시 청산되지 않게 하는 조건이 추가로 필요합니다. 위와 같은 상황이 발생하지 않게 아래식에는 우선 15틱 이상 수익이상 발생 후에 진입가로 되돌림되면 청산하게 제한 조건을 추가했습니다. 아래식 참고하셔서 수정보완하시기 바랍니다. input : Per1(28.2),시작시간(103000),종료시간(40000); Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0); 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 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); if MarketPosition == 0 and Tcond == true and entry < 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 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 == 1 Then{ if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*15 Then exitlong("bx",AtStop,EntryPrice); exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1); exitlong("bx2",atlimit,var1,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bx3",AtStop,var2,"",1,1); } if MarketPosition == -1 Then{ if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*15 Then ExitShort("sx",AtStop,EntryPrice); ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1); ExitShort("sx2",atlimit,var2,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx3",AtStop,var1,"",1,1); } SetStopLoss(PriceScale*15,PointStop); 즐거운 하루되세요 > 골든키 님이 쓴 글입니다. > 제목 : 수식부탁합니다 > 안녕하세요- 아래수식에서 #,조건만족시 매수 진입후 1차청산을 못하고 진입자리로 되돌림시 진입자리에서 매수 청산 매도 진입후 1차청산을 못하고 진입자라로 되돌림시 진입자리에서 매도 청산 하는식을 추가하면 좋겠습니다.(다른조건은 기존수식과 동일 유지) #,위의 되돌림 청산이후 기존수식(추가수식포함) 조건으로 매매시간 범위내에서 3회(변수)만 연속 재 진입하는 수식 부탁합니다. input : Per1(28.2),시작시간(103000),종료시간(40000); Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0); 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 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); if MarketPosition == 0 and Tcond == true and entry < 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 == 1 Then{ exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1); exitlong("bx2",atlimit,var1,"",1,1); if CurrentContracts < MaxContracts Then exitlong("bx3",AtStop,var2,"",1,1); } if MarketPosition == -1 Then{ ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1); ExitShort("sx2",atlimit,var2,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx3",AtStop,var1,"",1,1); } SetStopLoss(PriceScale*15,PointStop); ##,언제나 늘 감사합니다.