커뮤니티

문의 드립니다.

프로필 이미지
양치기
2014-11-19 07:10:35
159
글번호 80519
답변완료

첨부 이미지

항상 도움 주셔서 감사합니다. 문1) 아래와 같이 청산로직을 코딩하였는데 제대로 되는것 같지 않습니다. 도움 부탁드립니다. 첨부 그림 맨 하단을 보면 청산범위(수익 +10틱, 손실 -10틱)을 여러차례 벗어났지만 청산이 되지 않았습니다. 맨하단 위까지는 제대로 청산이 된것 같은데 마지막 포지션만 제대로 청산이 되지 않고 매매시간에 의해 청산이 되었습니다. 참고로 T_buy나 T_sell에 대한 포지션 진입도 동일 로직입니다. 도움 부탁드립니다. 종목은 유로FX 12월물 1분봉이고요 2014.11.18일 21시13분 포지션 진입건에 대해 문의 드립니다. if sTime >= 080400 or stime < 065000 Then { If MarketPosition == 0 Then { Buy("Buy",OnClose,def,vol); } if MarketPosition == 0 and 조건만족시 Then { Sell("T_sell",OnClose,def,vol); } If MarketPosition == 0 Then { sell("Sell",OnClose,def,vol); } if MarketPosition == 0 and 조건만족식 Then { Buy("T_buy",OnClose,def,vol); } if stime == 065000 or (stime > 065000 and stime[1] < 065000) Then{ ExitLong("B_Off"); ExitShort("S_Off"); } if MarketPosition == 1 and IsEntryname("T_buy") == true Then { var3 = highest(H,BarsSinceEntry); if var3 >= EntryPrice-PriceScale*10 and var3 < EntryPrice+PriceScale*10 then ExitLong("t_bx0",AtStop,EntryPrice-PriceScale*10); if var3 >= EntryPrice+PriceScale*15 and var3 < EntryPrice+PriceScale*20 then ExitLong("t_bx1",AtStop,EntryPrice+PriceScale*15); if var3 >= EntryPrice+PriceScale*20 and var3 < EntryPrice+PriceScale*25 then ExitLong("t_bx2",AtStop,EntryPrice+PriceScale*20); if var3 >= EntryPrice+PriceScale*25 and var3 < EntryPrice+PriceScale*30 then ExitLong("t_bx3",AtStop,EntryPrice+PriceScale*25); if var3 >= EntryPrice+PriceScale*30 then ExitLong("t_bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("T_sell") == true Then { var4 = lowest(L,BarsSinceEntry); if var4 <= EntryPrice+PriceScale*10 and var4 > EntryPrice-PriceScale*10 then ExitShort("t_sx0",AtStop,EntryPrice+PriceScale*10); if var4 <= EntryPrice-PriceScale*15 and var4 > EntryPrice-PriceScale*20 then ExitShort("t_sx1",AtStop,EntryPrice-PriceScale*15); if var4 <= EntryPrice-PriceScale*20 and var4 > EntryPrice-PriceScale*25 then ExitShort("t_sx2",AtStop,EntryPrice-PriceScale*20); if var4 <= EntryPrice-PriceScale*25 and var4 > EntryPrice-PriceScale*30 then ExitShort("t_sx3",AtStop,EntryPrice-PriceScale*25); if var4 <= EntryPrice-PriceScale*30 then ExitShort("t_sx4",AtStop,EntryPrice-PriceScale*30); } #============================================ if MarketPosition == 1 and IsEntryname("T_buy") != true Then { var1 = highest(H,BarsSinceEntry); if var1 < EntryPrice-PriceScale*10 then ExitLong("bx",AtMarket); if var1 >= EntryPrice-PriceScale*10 and var1 < EntryPrice+PriceScale*10 then ExitLong("bx0",AtStop,EntryPrice-PriceScale*10); if var1 >= EntryPrice+PriceScale*15 and var1 < EntryPrice+PriceScale*20 then ExitLong("bx1",AtStop,EntryPrice+PriceScale*15); if var1 >= EntryPrice+PriceScale*20 and var1 < EntryPrice+PriceScale*25 then ExitLong("bx2",AtStop,EntryPrice+PriceScale*20); if var1 >= EntryPrice+PriceScale*25 and var1 < EntryPrice+PriceScale*30 then ExitLong("bx3",AtStop,EntryPrice+PriceScale*25); if var1 >= EntryPrice+PriceScale*30 then ExitLong("bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("T_sell") != true Then { var2 = lowest(L,BarsSinceEntry); if var1 > EntryPrice+PriceScale*10 then ExitLong("sx",AtMarket); if var2 <= EntryPrice+PriceScale*10 and var2 > EntryPrice-PriceScale*10 then ExitShort("sx0",AtStop,EntryPrice+PriceScale*10); if var2 <= EntryPrice-PriceScale*15 and var2 > EntryPrice-PriceScale*20 then ExitShort("sx1",AtStop,EntryPrice-PriceScale*10); if var2 <= EntryPrice-PriceScale*20 and var2 > EntryPrice-PriceScale*25 then ExitShort("sx2",AtStop,EntryPrice-PriceScale*20); if var2 <= EntryPrice-PriceScale*25 and var2 > EntryPrice-PriceScale*30 then ExitShort("sx3",AtStop,EntryPrice-PriceScale*25); if var2 <= EntryPrice-PriceScale*30 then ExitShort("sx4",AtStop,EntryPrice-PriceScale*30); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-11-19 13:51:01

안녕하세요 예스스탁입니다. 현재 각 청산식에 진입명이 지정이 되어 있습니다. 2014.11.18일 21시13분에 진입된 명칭은 "sell"입니다. If MarketPosition == 0 Then { sell("Sell",OnClose,def,vol); } 청산식이 "sell"이나 "buy"로 진입시에는 해당 청산식 동작하지 않습니다. if MarketPosition == 1 and IsEntryname("T_buy") == true Then { var3 = highest(H,BarsSinceEntry); if var3 >= EntryPrice+PriceScale*10 and var3 < EntryPrice+PriceScale*15 then ExitLong("t_bx0",AtStop,EntryPrice-PriceScale*10); if var3 >= EntryPrice+PriceScale*15 and var3 < EntryPrice+PriceScale*20 then ExitLong("t_bx1",AtStop,EntryPrice+PriceScale*15); if var3 >= EntryPrice+PriceScale*20 and var3 < EntryPrice+PriceScale*25 then ExitLong("t_bx2",AtStop,EntryPrice+PriceScale*20); if var3 >= EntryPrice+PriceScale*25 and var3 < EntryPrice+PriceScale*30 then ExitLong("t_bx3",AtStop,EntryPrice+PriceScale*25); if var3 >= EntryPrice+PriceScale*30 then ExitLong("t_bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("T_sell") == true Then { var4 = lowest(L,BarsSinceEntry); if var4 <= EntryPrice-PriceScale*10 and var4 > EntryPrice-PriceScale*10 then ExitShort("t_sx0",AtStop,EntryPrice+PriceScale*10); if var4 <= EntryPrice-PriceScale*15 and var4 > EntryPrice-PriceScale*20 then ExitShort("t_sx1",AtStop,EntryPrice-PriceScale*15); if var4 <= EntryPrice-PriceScale*20 and var4 > EntryPrice-PriceScale*25 then ExitShort("t_sx2",AtStop,EntryPrice-PriceScale*20); if var4 <= EntryPrice-PriceScale*25 and var4 > EntryPrice-PriceScale*30 then ExitShort("t_sx3",AtStop,EntryPrice-PriceScale*25); if var4 <= EntryPrice-PriceScale*30 then ExitShort("t_sx4",AtStop,EntryPrice-PriceScale*30); } #============================================ if MarketPosition == 1 and IsEntryname("buy") == true Then { var3 = highest(H,BarsSinceEntry); if var3 >= EntryPrice+PriceScale*10 and var3 < EntryPrice+PriceScale*15 then ExitLong("bx0",AtStop,EntryPrice-PriceScale*10); if var3 >= EntryPrice+PriceScale*15 and var3 < EntryPrice+PriceScale*20 then ExitLong("bx1",AtStop,EntryPrice+PriceScale*15); if var3 >= EntryPrice+PriceScale*20 and var3 < EntryPrice+PriceScale*25 then ExitLong("bx2",AtStop,EntryPrice+PriceScale*20); if var3 >= EntryPrice+PriceScale*25 and var3 < EntryPrice+PriceScale*30 then ExitLong("bx3",AtStop,EntryPrice+PriceScale*25); if var3 >= EntryPrice+PriceScale*30 then ExitLong("bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("sell") == true Then { var4 = lowest(L,BarsSinceEntry); if var4 <= EntryPrice-PriceScale*10 and var4 > EntryPrice-PriceScale*15 then ExitShort("sx0",AtStop,EntryPrice+PriceScale*10); if var4 <= EntryPrice-PriceScale*15 and var4 > EntryPrice-PriceScale*20 then ExitShort("sx1",AtStop,EntryPrice-PriceScale*15); if var4 <= EntryPrice-PriceScale*20 and var4 > EntryPrice-PriceScale*25 then ExitShort("sx2",AtStop,EntryPrice-PriceScale*20); if var4 <= EntryPrice-PriceScale*25 and var4 > EntryPrice-PriceScale*30 then ExitShort("sx3",AtStop,EntryPrice-PriceScale*25); if var4 <= EntryPrice-PriceScale*30 then ExitShort("sx4",AtStop,EntryPrice-PriceScale*30); } 즐거운 하루되세요 > 양치기 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 항상 도움 주셔서 감사합니다. 문1) 아래와 같이 청산로직을 코딩하였는데 제대로 되는것 같지 않습니다. 도움 부탁드립니다. 첨부 그림 맨 하단을 보면 청산범위(수익 +10틱, 손실 -10틱)을 여러차례 벗어났지만 청산이 되지 않았습니다. 맨하단 위까지는 제대로 청산이 된것 같은데 마지막 포지션만 제대로 청산이 되지 않고 매매시간에 의해 청산이 되었습니다. 참고로 T_buy나 T_sell에 대한 포지션 진입도 동일 로직입니다. 도움 부탁드립니다. 종목은 유로FX 12월물 1분봉이고요 2014.11.18일 21시13분 포지션 진입건에 대해 문의 드립니다. if sTime >= 080400 or stime < 065000 Then { If MarketPosition == 0 Then { Buy("Buy",OnClose,def,vol); } if MarketPosition == 0 and 조건만족시 Then { Sell("T_sell",OnClose,def,vol); } If MarketPosition == 0 Then { sell("Sell",OnClose,def,vol); } if MarketPosition == 0 and 조건만족식 Then { Buy("T_buy",OnClose,def,vol); } if stime == 065000 or (stime > 065000 and stime[1] < 065000) Then{ ExitLong("B_Off"); ExitShort("S_Off"); } if MarketPosition == 1 and IsEntryname("T_buy") == true Then { var3 = highest(H,BarsSinceEntry); if var3 >= EntryPrice-PriceScale*10 and var3 < EntryPrice+PriceScale*10 then ExitLong("t_bx0",AtStop,EntryPrice-PriceScale*10); if var3 >= EntryPrice+PriceScale*15 and var3 < EntryPrice+PriceScale*20 then ExitLong("t_bx1",AtStop,EntryPrice+PriceScale*15); if var3 >= EntryPrice+PriceScale*20 and var3 < EntryPrice+PriceScale*25 then ExitLong("t_bx2",AtStop,EntryPrice+PriceScale*20); if var3 >= EntryPrice+PriceScale*25 and var3 < EntryPrice+PriceScale*30 then ExitLong("t_bx3",AtStop,EntryPrice+PriceScale*25); if var3 >= EntryPrice+PriceScale*30 then ExitLong("t_bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("T_sell") == true Then { var4 = lowest(L,BarsSinceEntry); if var4 <= EntryPrice+PriceScale*10 and var4 > EntryPrice-PriceScale*10 then ExitShort("t_sx0",AtStop,EntryPrice+PriceScale*10); if var4 <= EntryPrice-PriceScale*15 and var4 > EntryPrice-PriceScale*20 then ExitShort("t_sx1",AtStop,EntryPrice-PriceScale*15); if var4 <= EntryPrice-PriceScale*20 and var4 > EntryPrice-PriceScale*25 then ExitShort("t_sx2",AtStop,EntryPrice-PriceScale*20); if var4 <= EntryPrice-PriceScale*25 and var4 > EntryPrice-PriceScale*30 then ExitShort("t_sx3",AtStop,EntryPrice-PriceScale*25); if var4 <= EntryPrice-PriceScale*30 then ExitShort("t_sx4",AtStop,EntryPrice-PriceScale*30); } #============================================ if MarketPosition == 1 and IsEntryname("T_buy") != true Then { var1 = highest(H,BarsSinceEntry); if var1 < EntryPrice-PriceScale*10 then ExitLong("bx",AtMarket); if var1 >= EntryPrice-PriceScale*10 and var1 < EntryPrice+PriceScale*10 then ExitLong("bx0",AtStop,EntryPrice-PriceScale*10); if var1 >= EntryPrice+PriceScale*15 and var1 < EntryPrice+PriceScale*20 then ExitLong("bx1",AtStop,EntryPrice+PriceScale*15); if var1 >= EntryPrice+PriceScale*20 and var1 < EntryPrice+PriceScale*25 then ExitLong("bx2",AtStop,EntryPrice+PriceScale*20); if var1 >= EntryPrice+PriceScale*25 and var1 < EntryPrice+PriceScale*30 then ExitLong("bx3",AtStop,EntryPrice+PriceScale*25); if var1 >= EntryPrice+PriceScale*30 then ExitLong("bx4",AtStop,EntryPrice+PriceScale*30); } if MarketPosition == -1 and IsEntryname("T_sell") != true Then { var2 = lowest(L,BarsSinceEntry); if var1 > EntryPrice+PriceScale*10 then ExitLong("sx",AtMarket); if var2 <= EntryPrice+PriceScale*10 and var2 > EntryPrice-PriceScale*10 then ExitShort("sx0",AtStop,EntryPrice+PriceScale*10); if var2 <= EntryPrice-PriceScale*15 and var2 > EntryPrice-PriceScale*20 then ExitShort("sx1",AtStop,EntryPrice-PriceScale*10); if var2 <= EntryPrice-PriceScale*20 and var2 > EntryPrice-PriceScale*25 then ExitShort("sx2",AtStop,EntryPrice-PriceScale*20); if var2 <= EntryPrice-PriceScale*25 and var2 > EntryPrice-PriceScale*30 then ExitShort("sx3",AtStop,EntryPrice-PriceScale*25); if var2 <= EntryPrice-PriceScale*30 then ExitShort("sx4",AtStop,EntryPrice-PriceScale*30); }