커뮤니티

질문입니다.

프로필 이미지
yanartas
2017-06-07 15:11:04
139
글번호 110210
답변완료
전에 질문에 대한 답변을 다음과 같이 받았습니다. Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("BL",1) == true; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("SL",1) == true; if marketposition(0) <= 0 and crossup(c, ma(c, 5)) and Condition1 == false then { buy("B", atmarket, def, 1); } if marketposition(0) >=0 and crossdown(c, ma(c, 10)) and Condition2 == false then { sell("S", atmarket, def, 1); } if MarketPosition == 1 Then{ ExitLong("BL",AtStop,EntryPrice-2.0); if MaxEntries == 1 then buy("BB",AtStop,EntryPrice+PriceScale,1); } if MarketPosition == -1 Then{ ExitShort("SL",AtStop,EntryPrice-2.0); if MaxEntries == 1 then Sell("SS",AtStop,EntryPrice-PriceScale,1); } 위 시스템에서 한가지 질문이 있습니다. 한가지 문제점을 발견했는데, 예를들어 매도 "S" 신호가 발생한 후 매수 "B" 신호가 발생을 하였습니다. ("S", "B" 신호는 atmarket 입니다.) 그런데 제 의도와 다르게 매수 "B" 신호가 발생한 봉에서 매도피라미딩 신호인 "SS" 가 발생하는 경우가 있습니다. ("SS" 신호는 atstop 입니다.) 여튼 원래 의도는 매도 "S" 신호 후 매수 "B" 신호가 발생하였다면 매수로 전환되었으므로, 당연히 매도피라미딩 신호인 "SS"는 발생하지 않게 하고 싶습니다. (이런한 문제는 "B" 신호와 "SS" 신호가 동일봉에서 발생하는 듯 합니다.) 반대의 경우도 마찬가지 입니다. 즉, 매수 후 매도로 포지션이 전환되었다면, 전환 된 봉부터 매도피라미딩 조건만을 살피고 (매수피라미딩은 작동하지 않고,) 매도 후 매수로 포지션이 전환되었다면, 전환 된 봉부터 매수피라미딩 조건만을 살피게 (매도피라미딩은 작동하지 않게,) 하고 싶습니다. 위의 시스템에 더하여 예시로 부탁드립니다. 언제나 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-06-07 16:51:04

안녕하세요 예스스탁입니다. B매수 S신호 조건만족봉에서는 추가매수신호가 설정되지 않고 S매수 B신호 조건만족봉에서는 추가매도신호가 설정되지 않게 했습니다. var : T(0); Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("BL",1) == true; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("SL",1) == true; T = 0; if marketposition(0) <= 0 and crossup(c, ma(c, 5)) and Condition1 == false then { T = 1; buy("B", atmarket, def, 1); } if marketposition(0) >=0 and crossdown(c, ma(c, 10)) and Condition2 == false then { T = -1; sell("S", atmarket, def, 1); } if MarketPosition == 1 Then{ ExitLong("BL",AtStop,EntryPrice-2.0); if MaxEntries == 1 and T != -1 then buy("BB",AtStop,EntryPrice+PriceScale*4,1); } if MarketPosition == -1 Then{ ExitShort("SL",AtStop,EntryPrice-2.0); if MaxEntries == 1 and T != 1 then Sell("SS",AtStop,EntryPrice-PriceScale*4,1); } 즐거운 하루되세요 > yanartas 님이 쓴 글입니다. > 제목 : 질문입니다. > 전에 질문에 대한 답변을 다음과 같이 받았습니다. Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("BL",1) == true; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("SL",1) == true; if marketposition(0) <= 0 and crossup(c, ma(c, 5)) and Condition1 == false then { buy("B", atmarket, def, 1); } if marketposition(0) >=0 and crossdown(c, ma(c, 10)) and Condition2 == false then { sell("S", atmarket, def, 1); } if MarketPosition == 1 Then{ ExitLong("BL",AtStop,EntryPrice-2.0); if MaxEntries == 1 then buy("BB",AtStop,EntryPrice+PriceScale,1); } if MarketPosition == -1 Then{ ExitShort("SL",AtStop,EntryPrice-2.0); if MaxEntries == 1 then Sell("SS",AtStop,EntryPrice-PriceScale,1); } 위 시스템에서 한가지 질문이 있습니다. 한가지 문제점을 발견했는데, 예를들어 매도 "S" 신호가 발생한 후 매수 "B" 신호가 발생을 하였습니다. ("S", "B" 신호는 atmarket 입니다.) 그런데 제 의도와 다르게 매수 "B" 신호가 발생한 봉에서 매도피라미딩 신호인 "SS" 가 발생하는 경우가 있습니다. ("SS" 신호는 atstop 입니다.) 여튼 원래 의도는 매도 "S" 신호 후 매수 "B" 신호가 발생하였다면 매수로 전환되었으므로, 당연히 매도피라미딩 신호인 "SS"는 발생하지 않게 하고 싶습니다. (이런한 문제는 "B" 신호와 "SS" 신호가 동일봉에서 발생하는 듯 합니다.) 반대의 경우도 마찬가지 입니다. 즉, 매수 후 매도로 포지션이 전환되었다면, 전환 된 봉부터 매도피라미딩 조건만을 살피고 (매수피라미딩은 작동하지 않고,) 매도 후 매수로 포지션이 전환되었다면, 전환 된 봉부터 매수피라미딩 조건만을 살피게 (매도피라미딩은 작동하지 않게,) 하고 싶습니다. 위의 시스템에 더하여 예시로 부탁드립니다. 언제나 감사합니다.