커뮤니티

질문입니다.

프로필 이미지
yanartas
2017-06-03 13:18:38
122
글번호 110109
답변완료
예를들어 다음과 같은 시스템있다고 가정해봅니다. if marketposition(0) <= 0 && crossup(c, ma(c, 5)) then { buy("B", atmarket, def, 1); } if marketposition(0) >=0 && crossdown(c, ma(c, 10)) then { sell("S", atmarket, def, 1); } SetStopLoss(2.0, PointStop); 질문1. 위와같은 수식이 있을 때, 추가하고 싶은 내용이 만약 "B" 신호에서 stoploss가 발생했을 때, 다음신호는 "S"이게 하고 싶고, 신호 "S" 후 stoploss가 발생했을 때, 다음신호는 "B"이고 싶습니다. 즉, "B" 신호 후 발생한 stoploss 다음에 다시 "B" 신호가 나가지 않고, "S" 신호 후 발생한 stoploss 다음에 다시 "S" 신호가 나가지 않게 하고 싶습니다. 질문2. 만약 특정일에 stoploss가 발생했다면, 그날의 거래는 종료시키고, 다음거래일부터 발생하는 신호부터 다시 거래를 시작하게 만들고자합니다. 예시로 부탁드립니다. 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-06-05 11:22:16

안녕하세요 예스스탁입니다. 1 Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",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); } SetStopLoss(2.0, PointStop); 2 var : Xcond(false); if bdate != bdate[1] Then Xcond = false; if TotalTrades > TotalTrades[1] and IsExitName("StopLoss",1) == true Then Xcond = true; if marketposition(0) <= 0 and crossup(c, ma(c, 5)) and Xcond == false then { buy("B", atmarket, def, 1); } if marketposition(0) >=0 and crossdown(c, ma(c, 10)) and Xcond == false then { sell("S", atmarket, def, 1); } SetStopLoss(2.0, PointStop); 즐거운 하루되세요 > yanartas 님이 쓴 글입니다. > 제목 : 질문입니다. > 예를들어 다음과 같은 시스템있다고 가정해봅니다. if marketposition(0) <= 0 && crossup(c, ma(c, 5)) then { buy("B", atmarket, def, 1); } if marketposition(0) >=0 && crossdown(c, ma(c, 10)) then { sell("S", atmarket, def, 1); } SetStopLoss(2.0, PointStop); 질문1. 위와같은 수식이 있을 때, 추가하고 싶은 내용이 만약 "B" 신호에서 stoploss가 발생했을 때, 다음신호는 "S"이게 하고 싶고, 신호 "S" 후 stoploss가 발생했을 때, 다음신호는 "B"이고 싶습니다. 즉, "B" 신호 후 발생한 stoploss 다음에 다시 "B" 신호가 나가지 않고, "S" 신호 후 발생한 stoploss 다음에 다시 "S" 신호가 나가지 않게 하고 싶습니다. 질문2. 만약 특정일에 stoploss가 발생했다면, 그날의 거래는 종료시키고, 다음거래일부터 발생하는 신호부터 다시 거래를 시작하게 만들고자합니다. 예시로 부탁드립니다. 감사합니다.