커뮤니티
문의드립니다.
2015-07-20 11:35:11
109
글번호 88647
예를들어 선물거래 시스템을 1계약으로 만들었습니다.
input : ma1(10);
if marketposition(0) == 0 and crossup(c, ma1) then
{ buy("1", atmarket); }
input : ma2(20);
if marketposition(0) == 1 and crossdown(c, ma2) then
{ exitlong("x1", atmarket); }
여기에서 피라미딩전략을 이용해 진입신호 "1" 후에 "2"를 넣으려고 합니다.
input : ma1(10);
if marketposition(0) == 0 and crossup(c, ma1) then
{ buy("1", atmarket); }
input : L2(1);
if marketposition(0) == 1 then
{ buy("2", atstop, entryprice + L2); }
input : ma2(20);
if marketposition(0) == 1 and crossdown(c, ma2) then
{ exitlong("x1", atmarket); }
이렇게 말이죠....
그런데 문제는 신호 "2"가 청산신호인 "x1"과 동시에 나오는 것입니다.
제가 원하는 시스템은 신호 "1"과 "x1" 사이에 신호"2"를 넣고 싶습니다.
만약, 신호 "2"와 "x1"이 동시에 나온다면 "2"를 진입시키지 않고 그대로 청산만 하고 싶은데...
이를 코딩하기 위해서 어떻게 해야하나요?
간단한 예시와 함께 답변 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2015-07-20 15:19:26
안녕하세요
예스스탁입니다.
진입2의 조건에 C >= ma2 조건을 추가하시면 됩니다.
청산이 매수진입 후 현재봉 완성시에 데드크로스가 발생하면 다음봉 시가에 신호가 발생하므로
현재봉에서 데드크로스가 발생하지 않을때믄 매수2에서 atstop으로 entryprice + L2 가격을 지정해
감시하게 하시면 됩니다.
input : ma1(10);
if marketposition(0) == 0 and crossup(c, ma1) then
{ buy("1", atmarket); }
input : L2(1);
if marketposition(0) == 1 and c >= ma2 then
{ buy("2", atstop, entryprice + L2); }
input : ma2(20);
if marketposition(0) == 1 and crossdown(c, ma2) then
{ exitlong("x1", atmarket); }
즐거운 하루되세요
> yanartas 님이 쓴 글입니다.
> 제목 : 문의드립니다.
>
예를들어 선물거래 시스템을 1계약으로 만들었습니다.
input : ma1(10);
if marketposition(0) == 0 and crossup(c, ma1) then
{ buy("1", atmarket); }
input : ma2(20);
if marketposition(0) == 1 and crossdown(c, ma2) then
{ exitlong("x1", atmarket); }
여기에서 피라미딩전략을 이용해 진입신호 "1" 후에 "2"를 넣으려고 합니다.
input : ma1(10);
if marketposition(0) == 0 and crossup(c, ma1) then
{ buy("1", atmarket); }
input : L2(1);
if marketposition(0) == 1 then
{ buy("2", atstop, entryprice + L2); }
input : ma2(20);
if marketposition(0) == 1 and crossdown(c, ma2) then
{ exitlong("x1", atmarket); }
이렇게 말이죠....
그런데 문제는 신호 "2"가 청산신호인 "x1"과 동시에 나오는 것입니다.
제가 원하는 시스템은 신호 "1"과 "x1" 사이에 신호"2"를 넣고 싶습니다.
만약, 신호 "2"와 "x1"이 동시에 나온다면 "2"를 진입시키지 않고 그대로 청산만 하고 싶은데...
이를 코딩하기 위해서 어떻게 해야하나요?
간단한 예시와 함께 답변 부탁드립니다.