커뮤니티

추가 질문 드립니다..

프로필 이미지
데몬
2013-06-20 00:42:32
162
글번호 64530
답변완료
프로그램이 훨씬 복잡해지네요.. 1) 아래 부분이 왜 들어갔는지 모르겠습니다. 매수포지션이 없는데 어떻게 exit long이 될수 있는건가요? if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } 2) 당일 청산이 아니고, 해외 선물이라서 16시 00분 청산, 16시 15분이 시가로 잡고 싶습니다.. 아래와 같이 바꾸는게 맞을까요? OpenD => data2(O[0]) *여기서 data2 는 일봉 차트입니다. #당일청산 SetStopEndofday(160000); =================== 안녕하세요 예스스탁입니다. var : Bcond1(false),Bcond2(false),Bcond3(false),BEntryVol(0); var : Scond1(false),Scond2(false),Scond3(false),SEntryVol(0); if date != date[1] Then{ Bcond1 = false; Bcond2 = false; Bcond3 = false; Scond1 = false; Scond2 = false; Scond3 = false; } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) >= EntryPrice+0.3 Then Bcond1 = true; if highest(H,BarsSinceEntry) >= EntryPrice+0.9 Then Bcond2 = true; if highest(H,BarsSinceEntry) >= EntryPrice+2.0 Then Bcond3 = true; } if MarketPosition == -1 Then{ if Lowest(L,BarsSinceEntry) <= EntryPrice-0.3 Then Scond1 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-0.9 Then Scond2 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-2.0 Then Scond3 = true; } if Bcond1 == false and Bcond2 == false and Bcond3 == false Then BEntryVol = 10; if Bcond1 == true and Bcond2 == false and Bcond3 == false Then BEntryVol = 8; if Bcond1 == true and Bcond2 == true and Bcond3 == false Then BEntryVol = 3; if Bcond1 == true and Bcond2 == true and Bcond3 == true Then BEntryVol = 0; if Scond1 == false and Scond2 == false and Scond3 == false Then SEntryVol = 10; if Scond1 == true and Scond2 == false and Scond3 == false Then SEntryVol = 8; if Scond1 == true and Scond2 == true and Scond3 == false Then SEntryVol = 3; if Scond1 == true and Scond2 == true and Scond3 == true Then SEntryVol = 0; if MarketPosition <= 0 and crossup(c,OpenD(0)) Then buy("b",OnClose,def,BEntryVol); if MarketPosition == 1 Then{ if Bcond1 == false Then ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } if MarketPosition >= 0 and CrossDown(C,OpenD(0)) Then sell("s",OnClose,def,SentryVol); if MarketPosition == -1 Then{ if Scond1 == false Then ExitShort("sx1",atlimit,EntryPrice-0.3,"",2,1); if Scond2 == false Then ExitShort("sx2",atlimit,EntryPrice-0.9,"",5,1); if Scond3 == false Then ExitShort("sx3",atlimit,EntryPrice-2.0,"",3,1); } if MarketPosition != -1 Then{ if Scond1 == false Then ExitShort("sx11",atlimit,c-0.3,"",2,1); if Scond2 == false Then ExitShort("sx12",atlimit,c-0.9,"",5,1); if Scond3 == false Then ExitShort("sx13",atlimit,c-2.0,"",3,1); } #당일청산 SetStopEndofday(150000); 즐거운 하루되세요
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-06-20 14:36:22

안녕하세요 예스스탁입니다. 1. if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } 위 식은 매수진입봉 다음봉에 조건만족하면 매수청산신호를 내기 위한 식입니다. 직입이 onclose이므로 진입신호가 난봉은 MarketPosition은 0이고 진입신호가 발생한 봉 다음봉 부터 MarketPosition 은 1이됩니다. if MarketPosition == 1 Then{ if Bcond1 == false Then ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } 그러므로 위식은 진입봉 다음봉에 atlimit이 설정되어 다시 그다음봉 부터 신호가 발생하므로 진입봉 다음봉에서는 신호가 발생하지 않으므로 매수진입이 발생한 봉에서 같이 atlimit으로 청산조건을 걸어 진입봉 다음봉에서 신호가 발생하게 하기 위와 같은 식을 추가한 것입니다. 2, 해외선물이시면 당일청산함수를 사용하시면 안됩니다. 아래와 같이 시간을 지정해 시가와 당일청산을 하시면 됩니다. var : Bcond1(false),Bcond2(false),Bcond3(false),BEntryVol(0); var : Scond1(false),Scond2(false),Scond3(false),SEntryVol(0); var : DOpen(0); if stime == 161500 or (stime > 161500 and stime[1] < 161500) Then{ DOpen = O; Bcond1 = false; Bcond2 = false; Bcond3 = false; Scond1 = false; Scond2 = false; Scond3 = false; } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) >= EntryPrice+0.3 Then Bcond1 = true; if highest(H,BarsSinceEntry) >= EntryPrice+0.9 Then Bcond2 = true; if highest(H,BarsSinceEntry) >= EntryPrice+2.0 Then Bcond3 = true; } if MarketPosition == -1 Then{ if Lowest(L,BarsSinceEntry) <= EntryPrice-0.3 Then Scond1 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-0.9 Then Scond2 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-2.0 Then Scond3 = true; } if Bcond1 == false and Bcond2 == false and Bcond3 == false Then BEntryVol = 10; if Bcond1 == true and Bcond2 == false and Bcond3 == false Then BEntryVol = 8; if Bcond1 == true and Bcond2 == true and Bcond3 == false Then BEntryVol = 3; if Bcond1 == true and Bcond2 == true and Bcond3 == true Then BEntryVol = 0; if Scond1 == false and Scond2 == false and Scond3 == false Then SEntryVol = 10; if Scond1 == true and Scond2 == false and Scond3 == false Then SEntryVol = 8; if Scond1 == true and Scond2 == true and Scond3 == false Then SEntryVol = 3; if Scond1 == true and Scond2 == true and Scond3 == true Then SEntryVol = 0; if MarketPosition <= 0 and crossup(c,DOpen) Then buy("b",OnClose,def,BEntryVol); if MarketPosition == 1 Then{ if Bcond1 == false Then ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } if MarketPosition >= 0 and CrossDown(C,DOpen) Then sell("s",OnClose,def,SentryVol); if MarketPosition == -1 Then{ if Scond1 == false Then ExitShort("sx1",atlimit,EntryPrice-0.3,"",2,1); if Scond2 == false Then ExitShort("sx2",atlimit,EntryPrice-0.9,"",5,1); if Scond3 == false Then ExitShort("sx3",atlimit,EntryPrice-2.0,"",3,1); } if MarketPosition != -1 Then{ if Scond1 == false Then ExitShort("sx11",atlimit,c-0.3,"",2,1); if Scond2 == false Then ExitShort("sx12",atlimit,c-0.9,"",5,1); if Scond3 == false Then ExitShort("sx13",atlimit,c-2.0,"",3,1); } #당일청산 if stime == 160000 or (stime > 160000 and stime[1] < 160000) Then{ ExitLong(); ExitShort(); } 즐거운 하루되세요 > 데몬 님이 쓴 글입니다. > 제목 : 추가 질문 드립니다.. > 프로그램이 훨씬 복잡해지네요.. 1) 아래 부분이 왜 들어갔는지 모르겠습니다. 매수포지션이 없는데 어떻게 exit long이 될수 있는건가요? if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } 2) 당일 청산이 아니고, 해외 선물이라서 16시 00분 청산, 16시 15분이 시가로 잡고 싶습니다.. 아래와 같이 바꾸는게 맞을까요? OpenD => data2(O[0]) *여기서 data2 는 일봉 차트입니다. #당일청산 SetStopEndofday(160000); =================== 안녕하세요 예스스탁입니다. var : Bcond1(false),Bcond2(false),Bcond3(false),BEntryVol(0); var : Scond1(false),Scond2(false),Scond3(false),SEntryVol(0); if date != date[1] Then{ Bcond1 = false; Bcond2 = false; Bcond3 = false; Scond1 = false; Scond2 = false; Scond3 = false; } if MarketPosition == 1 Then{ if highest(H,BarsSinceEntry) >= EntryPrice+0.3 Then Bcond1 = true; if highest(H,BarsSinceEntry) >= EntryPrice+0.9 Then Bcond2 = true; if highest(H,BarsSinceEntry) >= EntryPrice+2.0 Then Bcond3 = true; } if MarketPosition == -1 Then{ if Lowest(L,BarsSinceEntry) <= EntryPrice-0.3 Then Scond1 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-0.9 Then Scond2 = true; if Lowest(L,BarsSinceEntry) <= EntryPrice-2.0 Then Scond3 = true; } if Bcond1 == false and Bcond2 == false and Bcond3 == false Then BEntryVol = 10; if Bcond1 == true and Bcond2 == false and Bcond3 == false Then BEntryVol = 8; if Bcond1 == true and Bcond2 == true and Bcond3 == false Then BEntryVol = 3; if Bcond1 == true and Bcond2 == true and Bcond3 == true Then BEntryVol = 0; if Scond1 == false and Scond2 == false and Scond3 == false Then SEntryVol = 10; if Scond1 == true and Scond2 == false and Scond3 == false Then SEntryVol = 8; if Scond1 == true and Scond2 == true and Scond3 == false Then SEntryVol = 3; if Scond1 == true and Scond2 == true and Scond3 == true Then SEntryVol = 0; if MarketPosition <= 0 and crossup(c,OpenD(0)) Then buy("b",OnClose,def,BEntryVol); if MarketPosition == 1 Then{ if Bcond1 == false Then ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } if MarketPosition != 1 Then{ if Bcond1 == false Then ExitLong("bx11",atlimit,C+0.3,"",2,1); if Bcond2 == false Then ExitLong("bx12",atlimit,C+0.9,"",5,1); if Bcond3 == false Then ExitLong("bx13",atlimit,C+2.0,"",3,1); } if MarketPosition >= 0 and CrossDown(C,OpenD(0)) Then sell("s",OnClose,def,SentryVol); if MarketPosition == -1 Then{ if Scond1 == false Then ExitShort("sx1",atlimit,EntryPrice-0.3,"",2,1); if Scond2 == false Then ExitShort("sx2",atlimit,EntryPrice-0.9,"",5,1); if Scond3 == false Then ExitShort("sx3",atlimit,EntryPrice-2.0,"",3,1); } if MarketPosition != -1 Then{ if Scond1 == false Then ExitShort("sx11",atlimit,c-0.3,"",2,1); if Scond2 == false Then ExitShort("sx12",atlimit,c-0.9,"",5,1); if Scond3 == false Then ExitShort("sx13",atlimit,c-2.0,"",3,1); } #당일청산 SetStopEndofday(150000); 즐거운 하루되세요