커뮤니티

재문의 드립니다.

프로필 이미지
베비슬립
2019-06-29 03:46:44
196
글번호 129829
답변완료
안녕하세요 매수와 매도는 진입이 잘되는데 청산이 안되는것같습니다.. 혼자 이리저리 만지다가 exitlong부분을 지우니 exitshort는 정상적으로 작동하는것같더라고요 근데 수식이 꼬여서 예스랭귀지가 튕깁니다.. 종목은 크루드오일이구요 청산이되게 확인부탁드려요ㅜㅜ 항상건강하세요
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-06-28 10:31:37

안녕하세요 예스스탁입니다. 식을 수정했습니다. 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*70; R1 = DayLow+PriceScale*35; S1 = DayHigh-PriceScale*35; S2 = DayHigh-PriceScale*70; 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); 2 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*70; R1 = DayLow+PriceScale*35; S1 = DayHigh-PriceScale*35; S2 = DayHigh-PriceScale*70; 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,1); if L > S1 then buy("b2",AtLimit,S1,1); } if MarketPosition >= 0 and entry < 1 Then { if L > R1 Then sell("R1",AtStop,R1,1); if H < R1 Then sell("R2",AtLimit,R1,1); } if MarketPosition == 1 then { if H < R1 Then ExitLong("bx11",AtLimit,R1,"",1,1); if L > R1 Then ExitLong("bx12",AtStop,R1,"",1,1); } if MarketPosition == -1 then { if L > S1 Then ExitShort("sx11",AtLimit,S1,"",1,1); if H < S1 Then ExitShort("sx12",AtStop,S1,"",1,1); } } SetStopLoss(PriceScale*20,PointStop); 즐거운 하루되세요 > 베비슬립 님이 쓴 글입니다. > 제목 : 재문의 드립니다. > 안녕하세요 매수와 매도는 진입이 잘되는데 청산이 안되는것같습니다.. 혼자 이리저리 만지다가 exitlong부분을 지우니 exitshort는 정상적으로 작동하는것같더라고요 근데 수식이 꼬여서 예스랭귀지가 튕깁니다.. 종목은 크루드오일이구요 청산이되게 확인부탁드려요ㅜㅜ 그리고 추가로 당일1회 1계약 진입으로 dayhigh -35틱(S1) 에서 매수진입시 daylow+35틱(R1)지점에서 청산 daylow + 35틱(R1)에서 매도진입시 dayhigh+35틱(S1)지점에서 청산 -20틱 손절 이런시스템도하나 부탁드립니다.. 재문의드려서 죄송합니다! 항상건강하세요 --------------------------------------------------------------------- 처음질문내용 *총 3계약 당일 1회만 진입 R2 : daylow()+70틱 R1 : daylow()+35틱 S1 : dayhigh()-35틱 S2 : dayhigh()-70틱 매수진입3계약 : S1도달시 매도진입3계약 : R1도달시 매도진입시 1차청산 : dayhigh - 35틱 (S1) 2차청산 : dayhigh - 70틱 (S2) 3차청산 : 장시간 끝나기 1시간전 포지션청산 35틱이상 가격내려갔을시 2차부터 본절청산 손절 : -20틱 매수진입시 1차청산 daylow + 35틱 (R1) 2차청산 daylow + 70틱 (R2) 3차청산 장시간끝나기 1시간전 포지션청산 35틱이상 상승했을시 2차부터 본절청산 손절 : -20틱 ------------------------------------------------------------------------- 만들어주신내용 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*70; R1 = DayLow+PriceScale*35; S1 = DayHigh-PriceScale*35; S2 = DayHigh-PriceScale*70; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry+1; if Tcond == true and entry < 1 then { if MarketPosition <= 0 Then { if H < S1 Then buy("b1",AtStop,S1,3); if L > S1 then buy("b2",AtLimit,S1,3); } if MarketPosition >= 0 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 L > S1 Then ExitShort("sx11",AtLimit,S1,"",1,1); if H < S1 Then ExitShort("sx12",AtStop,S1,"",1,1); 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);