커뮤니티

수식문의드립니다.

프로필 이미지
베비슬립
2019-07-05 10:39:16
239
글번호 130082
답변완료
예전에 만들어주셨던수식인데 매수, 매도 각각하루1회를 매수와 매도 통틀어서 하루 1회만 진입되게 수정부탁드립니다. 감사합니다. ------------------ input : xtime(050000); var : R2(0),R1(0),S1(0),S2(0),entry(0); var : Tcond(false),BX1(false),BX2(false),SX1(false),SX2(false); if bdate != bdate[1] then { Tcond = true; entry = 0; } if (sdate != sdate[1] and stime >= xtime) or (sdate == sdate[1] and stime >= xtime and stime[1] < xtime) then { Tcond = false; if MarketPosition == 1 Then ExitLong("BX"); if MarketPosition == -1 Then ExitShort("SX"); } R2 = DayLow+PriceScale*200; R1 = DayLow+PriceScale*100; S1 = DayHigh-PriceScale*100; S2 = DayHigh-PriceScale*200; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry+1; if Tcond == true then { if MarketPosition <= 0 and entry < 1 Then { if H < S1 Then buy("b1",AtStop,S1,3); if L > S1 then buy("b2",AtLimit,S1,3); } if MarketPosition >= 0 and entry < 1 Then { if L > R1 Then sell("R1",AtStop,R1,3); if H < R1 Then sell("R2",AtLimit,R1,3); } if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { BX1 = false; BX2 = false; } if CurrentContracts < CurrentContracts[1] then { if (LatestExitName(0) == "bx11" or LatestExitName(0) == "bx12") Then BX1 = true; if (LatestExitName(0) == "bx21" or LatestExitName(0) == "bx22") Then BX2 = true; } if BX1 == false Then { if H < R1 Then ExitLong("bx11",AtLimit,R1,"",1,1); if L > R1 Then ExitLong("bx12",AtStop,R1,"",1,1); } if BX2 == false Then { if H < R2 Then ExitLong("bx21",AtLimit,R2,"",1,1); if L > R2 Then ExitLong("bx22",AtStop,R2,"",1,1); } if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*35 Then ExitLong("bx3",AtStop,EntryPrice); } if MarketPosition == -1 then { if CurrentContracts > CurrentContracts[1] Then { SX1 = false; SX2 = false; } if CurrentContracts < CurrentContracts[1] then { if (LatestExitName(0) == "sx11" or LatestExitName(0) == "sx12") Then SX1 = true; if (LatestExitName(0) == "sx21" or LatestExitName(0) == "sx22") Then SX2 = true; } if SX1 == False then { if L > S1 Then ExitShort("sx11",AtLimit,S1,"",1,1); if H < S1 Then ExitShort("sx12",AtStop,S1,"",1,1); } if SX2 == false then { if L > S2 Then ExitShort("sx21",AtLimit,S2,"",1,1); if H < S2 Then ExitShort("sx22",AtStop,S2,"",1,1); } if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*35 Then ExitShort("sx3",AtStop,EntryPrice); } } SetStopLoss(PriceScale*20,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-07-05 13:13:20

안녕하세요 예스스탁입니다. 올려주신 수식이 하루에 한번 진입을 하는 수식입니다. 별도로 수정해 드릴 부분이 없습니다. 즐거운 하루되세요 > 베비슬립 님이 쓴 글입니다. > 제목 : 수식문의드립니다. > 예전에 만들어주셨던수식인데 매수, 매도 각각하루1회를 매수와 매도 통틀어서 하루 1회만 진입되게 수정부탁드립니다. 감사합니다. ------------------ input : xtime(050000); var : R2(0),R1(0),S1(0),S2(0),entry(0); var : Tcond(false),BX1(false),BX2(false),SX1(false),SX2(false); if bdate != bdate[1] then { Tcond = true; entry = 0; } if (sdate != sdate[1] and stime >= xtime) or (sdate == sdate[1] and stime >= xtime and stime[1] < xtime) then { Tcond = false; if MarketPosition == 1 Then ExitLong("BX"); if MarketPosition == -1 Then ExitShort("SX"); } R2 = DayLow+PriceScale*200; R1 = DayLow+PriceScale*100; S1 = DayHigh-PriceScale*100; S2 = DayHigh-PriceScale*200; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry+1; if Tcond == true then { if MarketPosition <= 0 and entry < 1 Then { if H < S1 Then buy("b1",AtStop,S1,3); if L > S1 then buy("b2",AtLimit,S1,3); } if MarketPosition >= 0 and entry < 1 Then { if L > R1 Then sell("R1",AtStop,R1,3); if H < R1 Then sell("R2",AtLimit,R1,3); } if MarketPosition == 1 then { if CurrentContracts > CurrentContracts[1] Then { BX1 = false; BX2 = false; } if CurrentContracts < CurrentContracts[1] then { if (LatestExitName(0) == "bx11" or LatestExitName(0) == "bx12") Then BX1 = true; if (LatestExitName(0) == "bx21" or LatestExitName(0) == "bx22") Then BX2 = true; } if BX1 == false Then { if H < R1 Then ExitLong("bx11",AtLimit,R1,"",1,1); if L > R1 Then ExitLong("bx12",AtStop,R1,"",1,1); } if BX2 == false Then { if H < R2 Then ExitLong("bx21",AtLimit,R2,"",1,1); if L > R2 Then ExitLong("bx22",AtStop,R2,"",1,1); } if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*35 Then ExitLong("bx3",AtStop,EntryPrice); } if MarketPosition == -1 then { if CurrentContracts > CurrentContracts[1] Then { SX1 = false; SX2 = false; } if CurrentContracts < CurrentContracts[1] then { if (LatestExitName(0) == "sx11" or LatestExitName(0) == "sx12") Then SX1 = true; if (LatestExitName(0) == "sx21" or LatestExitName(0) == "sx22") Then SX2 = true; } if SX1 == False then { if L > S1 Then ExitShort("sx11",AtLimit,S1,"",1,1); if H < S1 Then ExitShort("sx12",AtStop,S1,"",1,1); } if SX2 == false then { if L > S2 Then ExitShort("sx21",AtLimit,S2,"",1,1); if H < S2 Then ExitShort("sx22",AtStop,S2,"",1,1); } if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*35 Then ExitShort("sx3",AtStop,EntryPrice); } } SetStopLoss(PriceScale*20,PointStop);