커뮤니티

분할청산식을 만들어봤는데요....

프로필 이미지
회원
2011-02-08 16:41:30
777
글번호 35538
답변완료
var1 = int(90/BarInterval); var2 = Lowest(L,var1); var3 = bids - asks ; Condition1 = ExitDate(1) == sdate; #직전청산이 당일이면 true 전일이면 false if CrossDown(c,var2[1]) and dayindex > var1 and asks > bids and c < ma(c,20) and c < ma(c,60) and (Condition1 == false or (Condition1 == true and BarsSinceExit(1) >= var1)) Then { Sell("매도",OnClose,def,4); } # 매도/매수청산 if MarketPosition == 1 Then{ ExitShort("0.5피청산",atlimit,EntryPrice+0.5,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) >= EntryPrice+0.5 Then ExitShort("0.5피30청산",OnClose,def,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) <= EntryPrice+0.5 Then ExitShort("30청산",OnClose,def,"",2,1); if CrossUp(C,ma(C,60)) Then ExitShort("60청산",OnClose,def,"",1,1); if CrossUp(ma(C,20),ma(C,60)) Then ExitShort("2060청산",OnClose,def,"",1,1); } --------------------------------------------------------------------------------- 위와같이 선물1분봉을 기준으로 매도를 한 후 1개씩 나눠서 청산을하는식으로 만들어봤는데요 4번에 나눠서 청산이 안되고 한번에 청산이 되네요~ 문의드립니다~
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2011-02-08 18:09:57

안녕하세요 예스스탁입니다. 매도청산식의 조건으로 if MarketPosition == 1 Then을 사용하셔서 매도청산자체가 발동되지 않았습니다. if MarketPosition == -1 Then로 변경하시면 됩니다. 아래는 수정된 식입니다. var1 = int(90/BarInterval); var2 = Lowest(L,var1); var3 = bids - asks ; Condition1 = ExitDate(1) == sdate; #직전청산이 당일이면 true 전일이면 false if CrossDown(c,var2[1]) and dayindex > var1 and asks > bids and c < ma(c,20) and c < ma(c,60) and (Condition1 == false or (Condition1 == true and BarsSinceExit(1) >= var1)) Then { Sell("매도",OnClose,def,4); } # 매도/매수청산 if MarketPosition == -1 Then{ ExitShort("0.5피청산",atlimit,EntryPrice+0.5,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) >= EntryPrice+0.5 Then ExitShort("0.5피30청산",OnClose,def,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) <= EntryPrice+0.5 Then ExitShort("30청산",OnClose,def,"",2,1); if CrossUp(C,ma(C,60)) Then ExitShort("60청산",OnClose,def,"",1,1); if CrossUp(ma(C,20),ma(C,60)) Then ExitShort("2060청산",OnClose,def,"",1,1); } 즐거운 하루되세요 > HI_coco 님이 쓴 글입니다. > 제목 : 분할청산식을 만들어봤는데요.... > var1 = int(90/BarInterval); var2 = Lowest(L,var1); var3 = bids - asks ; Condition1 = ExitDate(1) == sdate; #직전청산이 당일이면 true 전일이면 false if CrossDown(c,var2[1]) and dayindex > var1 and asks > bids and c < ma(c,20) and c < ma(c,60) and (Condition1 == false or (Condition1 == true and BarsSinceExit(1) >= var1)) Then { Sell("매도",OnClose,def,4); } # 매도/매수청산 if MarketPosition == 1 Then{ ExitShort("0.5피청산",atlimit,EntryPrice+0.5,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) >= EntryPrice+0.5 Then ExitShort("0.5피30청산",OnClose,def,"",1,1); if CrossUp(C,ma(C,30)) and highest(H,BarsSinceEntry) <= EntryPrice+0.5 Then ExitShort("30청산",OnClose,def,"",2,1); if CrossUp(C,ma(C,60)) Then ExitShort("60청산",OnClose,def,"",1,1); if CrossUp(ma(C,20),ma(C,60)) Then ExitShort("2060청산",OnClose,def,"",1,1); } --------------------------------------------------------------------------------- 위와같이 선물1분봉을 기준으로 매도를 한 후 1개씩 나눠서 청산을하는식으로 만들어봤는데요 4번에 나눠서 청산이 안되고 한번에 청산이 되네요~ 문의드립니다~