커뮤니티
수식 부탁 드립니다. 다조건의 매수/매도 수식
2018-01-05 00:09:59
146
글번호 115481
안녕하세요. 시스템 트레이딩에서 아래와 같이 조건 1,2,3에 따라 각각 매수를 달리하려고 합니다. 어떻게 해야 할까요? 부탁 드립니다.
조건 1
if crossup(ema(O,10), ema(C,20)) then
buy("매수1", AtMarket, def, 10); //조건 1에 따라 매수
조건 2
if crossup(ema(O,20), ema(C,40)) then
buy("매수2", AtMarket, def, 10); //조건 2에 따라 매수
조건 3
if crossup(ema(O,30), ema(C,60)) then
buy("매수1", AtMarket, def, 10); //조건 3에 따라 매수
조건 1의 반대 신호 시, 매수1 청산
if crossdown(ema(O,10), ema(C,20)) then
exitlong("매수청산1", AtMarket, def, 10); //조건 1 반대 신호 시, 매수1 청산
조건 2의 반대 신호 시, 매수2 청산
if crossdown(ema(O,20), ema(C,40)) then
exitlong("매수청산2", AtMarket, def, 10);//조건 2 반대 신호 시, 매수2 청산
조건 3의 반대 신호 시, 매수3 청산
if crossdown(ema(O,30), ema(C,60)) then
exitlong("매수청산3", AtMarket, def, 10);//조건 3 반대 신호 시, 매수3 청산
답변 1
예스스탁 예스스탁 답변
2018-01-08 09:29:26
안녕하세요
예스스탁입니다.
if crossup(ema(O,10), ema(C,20)) then
buy("매수1", AtMarket, def, 10); //조건 1에 따라 매수
if crossup(ema(O,20), ema(C,40)) then
buy("매수2", AtMarket, def, 10); //조건 2에 따라 매수
if crossup(ema(O,30), ema(C,60)) then
buy("매수3", AtMarket, def, 10); //조건 3에 따라 매수
if MarketPosition == 1 and crossdown(ema(O,10), ema(C,20)) then
exitlong("매수청산1", AtMarket,def,"매수1");
if MarketPosition == 1 and crossdown(ema(O,20), ema(C,40)) then
exitlong("매수청산2", AtMarket,def,"매수2");
if MarketPosition == 1 and crossdown(ema(O,30), ema(C,60)) then
exitlong("매수청산3", AtMarket,def,"매수3");
즐거운 하루되세요
> 로마의아침 님이 쓴 글입니다.
> 제목 : 수식 부탁 드립니다. 다조건의 매수/매도 수식
> 안녕하세요. 시스템 트레이딩에서 아래와 같이 조건 1,2,3에 따라 각각 매수를 달리하려고 합니다. 어떻게 해야 할까요? 부탁 드립니다.
조건 1
if crossup(ema(O,10), ema(C,20)) then
buy("매수1", AtMarket, def, 10); //조건 1에 따라 매수
조건 2
if crossup(ema(O,20), ema(C,40)) then
buy("매수2", AtMarket, def, 10); //조건 2에 따라 매수
조건 3
if crossup(ema(O,30), ema(C,60)) then
buy("매수1", AtMarket, def, 10); //조건 3에 따라 매수
조건 1의 반대 신호 시, 매수1 청산
if crossdown(ema(O,10), ema(C,20)) then
exitlong("매수청산1", AtMarket, def, 10); //조건 1 반대 신호 시, 매수1 청산
조건 2의 반대 신호 시, 매수2 청산
if crossdown(ema(O,20), ema(C,40)) then
exitlong("매수청산2", AtMarket, def, 10);//조건 2 반대 신호 시, 매수2 청산
조건 3의 반대 신호 시, 매수3 청산
if crossdown(ema(O,30), ema(C,60)) then
exitlong("매수청산3", AtMarket, def, 10);//조건 3 반대 신호 시, 매수3 청산
다음글
이전글