커뮤니티

추가질문입니다.

프로필 이미지
데몬
2013-06-19 07:27:51
245
글번호 64485
답변완료
아래 답변 정말 감사합니다 ^^ 두가지 조건을 추가하고 싶은데요.. 1. 당일 잔량 청산 만약 당일에 10계약 진입했다가, 일부계약이 남아있을때, 당일에 무조건 전량을 청산하고 싶습니다 2. 재진입시 수량 조절 0.3 0.9 2.0 이라는 각지점을 하루에 한번씩만 청산되도록합니다. 즉, 이미 0.3을 닿았다면 매수로 재진입할때는 0.9(5계약) 와 2.0(3계약)만을 위한 매수진입합니다. CASE) 매수 신호로 들어가서 0.3(2계약)과 0.9(5계약)까지만 달성되고 2.0은 닿지 못하고, 매도로 들어갔다가, -0.3까지만 달성되고 다시 매수로 들어간다고 했을때, 이때는 2.0을 위한 3계약만 진입하는 로직이 필요합니다. 반대로 이후 매도로 재진입할때는 -0.3분량을 제외한 8계약만 매도로 재진입하도록요... 대단히 감사합니다 ^^ ================== 안녕하세요 예스스탁입니다. if c > OpenD(0) Then buy("b",OnClose,def,10); if MarketPosition == 1 Then{ ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } if C < OpenD(0) Then sell("s",OnClose,def,10); if MarketPosition == -1 Then{ ExitShort("sx1",atlimit,EntryPrice-0.3,"",2,1); ExitShort("sx2",atlimit,EntryPrice-0.9,"",5,1); ExitShort("sx3",atlimit,EntryPrice-2.0,"",3,1); } 즐거운 하루되세요
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-06-19 11:11:56

안녕하세요 예스스탁입니다. 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. 당일 잔량 청산 만약 당일에 10계약 진입했다가, 일부계약이 남아있을때, 당일에 무조건 전량을 청산하고 싶습니다 2. 재진입시 수량 조절 0.3 0.9 2.0 이라는 각지점을 하루에 한번씩만 청산되도록합니다. 즉, 이미 0.3을 닿았다면 매수로 재진입할때는 0.9(5계약) 와 2.0(3계약)만을 위한 매수진입합니다. CASE) 매수 신호로 들어가서 0.3(2계약)과 0.9(5계약)까지만 달성되고 2.0은 닿지 못하고, 매도로 들어갔다가, -0.3까지만 달성되고 다시 매수로 들어간다고 했을때, 이때는 2.0을 위한 3계약만 진입하는 로직이 필요합니다. 반대로 이후 매도로 재진입할때는 -0.3분량을 제외한 8계약만 매도로 재진입하도록요... 대단히 감사합니다 ^^ ================== 안녕하세요 예스스탁입니다. if c > OpenD(0) Then buy("b",OnClose,def,10); if MarketPosition == 1 Then{ ExitLong("bx1",atlimit,EntryPrice+0.3,"",2,1); ExitLong("bx2",atlimit,EntryPrice+0.9,"",5,1); ExitLong("bx3",atlimit,EntryPrice+2.0,"",3,1); } if C < OpenD(0) Then sell("s",OnClose,def,10); if MarketPosition == -1 Then{ ExitShort("sx1",atlimit,EntryPrice-0.3,"",2,1); ExitShort("sx2",atlimit,EntryPrice-0.9,"",5,1); ExitShort("sx3",atlimit,EntryPrice-2.0,"",3,1); } 즐거운 하루되세요