커뮤니티

수식 부탁합니다. 매매

프로필 이미지
타잔94
2017-02-05 16:42:55
115
글번호 106529
답변완료
Input : shortPeriod(12), longPeriod(26); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If CrossUP(value, 0) Then { Buy(); } # 매도/매수청산 If CrossDown(value, 0) Then { Sell(); } 기본 매매 수식인데... 2개의 계약을 들어가서 1개는 0.3~0.4p에서 정리하고 나머지 한 개는 청산 기준에서 또는 본청에서 처리를 하고 싶습니다. (2개 계약에서 손절 신호가 나오면 2개 전부 정리합니다.) 수고하세요. ^^
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-02-06 11:32:37

안녕하세요 예스스탁입니다. Input : shortPeriod(12), longPeriod(26); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If CrossUP(value, 0) Then { Buy("b",OnClose,def,2); } # 매도/매수청산 If CrossDown(value, 0) Then { Sell("s",OnClose,def,2); } if MarketPosition == 1 then{ if CurrentContracts == MaxContracts Then ExitLong("bx1",atlimit,EntryPrice+0.3,"",1,1); if CurrentContracts < MaxContracts Then ExitLong("bx2",AtStop,EntryPrice); } if MarketPosition == -1 then{ if CurrentContracts == MaxContracts Then ExitShort("sx1",atlimit,EntryPrice-0.3,"",1,1); if CurrentContracts < MaxContracts Then ExitShort("sx2",AtStop,EntryPrice); } 즐거운 하루되세요 > 타잔94 님이 쓴 글입니다. > 제목 : 수식 부탁합니다. 매매 > Input : shortPeriod(12), longPeriod(26); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If CrossUP(value, 0) Then { Buy(); } # 매도/매수청산 If CrossDown(value, 0) Then { Sell(); } 기본 매매 수식인데... 2개의 계약을 들어가서 1개는 0.3~0.4p에서 정리하고 나머지 한 개는 청산 기준에서 또는 본청에서 처리를 하고 싶습니다. (2개 계약에서 손절 신호가 나오면 2개 전부 정리합니다.) 수고하세요. ^^