Input : shortPeriod(5), longPeriod(20);
Var : 단기이평(0), 장기이평(0);
단기이평 = ma(C, shortPeriod);
장기이평 = ma(C, longPeriod);
if crossup(단기이평, 장기이평) then
buy();
if crossdown(단기이평, 장기이평) then
sell();
위와같이 전략을 작성했을경우 따로 청산수식을 하지않아도
매수매도 주문이되는가요??
아니면
단기이평 = ma(C, shortPeriod);
장기이평 = ma(C, longPeriod);
if crossup(단기이평, 장기이평) then
buy();
if crossdown(단기이평, 장기이평) then
sell();
if crossup(단기이평, 장기이평) then
exitshort();
if crossdown(단기이평, 장기이평) then
exitlong();
이렇게 청산전략을 넣어야 하나요??
답변 1
예스스탁
예스스탁 답변
2021-02-24 11:25:56
안녕하세요
예스스탁입니다.
진입함수가 반대포지션 상태에서 발생하면 반대포지션 청산도 같이하게 되므로
매수포지션청산과 매도진입조건이 같으면 매도진입식만
매도포지션청산과 매수진입조건이 같으면 매도진입식만 있으면 됩니다.
즐거운 하루되세요
> 천상나루 님이 쓴 글입니다.
> 제목 : 수식부탁드립니다
> Input : shortPeriod(5), longPeriod(20);
Var : 단기이평(0), 장기이평(0);
단기이평 = ma(C, shortPeriod);
장기이평 = ma(C, longPeriod);
if crossup(단기이평, 장기이평) then
buy();
if crossdown(단기이평, 장기이평) then
sell();
위와같이 전략을 작성했을경우 따로 청산수식을 하지않아도
매수매도 주문이되는가요??
아니면
단기이평 = ma(C, shortPeriod);
장기이평 = ma(C, longPeriod);
if crossup(단기이평, 장기이평) then
buy();
if crossdown(단기이평, 장기이평) then
sell();
if crossup(단기이평, 장기이평) then
exitshort();
if crossdown(단기이평, 장기이평) then
exitlong();
이렇게 청산전략을 넣어야 하나요??