커뮤니티

수식 문의

프로필 이미지
알파
2006-03-06 21:34:55
1163
글번호 9546
답변완료
정배열시 일정봉(10)지날때까지 일정금액(0.5)이 상승하면 매수 역배열시 일정봉 지날때까지 일정금액이 하락하면 매도 기본적으로 위의 식인데 식의 어디가 잘못된 건지 알수가 없네요 -매수만 적용할때와 매수매도식을 동시에 적용할때 결과가 다르게 나옵니다 부탁드립니다 감사합니다 input: p1(0.5);//매수상승폭 input: p2(10);//매수 봉의 갯수 input: p3(5); input: p4(20); input: p5(60); input: p6(0.5);//매도 하락폭 input: p7(10);//매도 봉의 갯수 var : value(0),idx(0),Cval(0), idx2(0), cval2(0); if ma(c,p3) > ma(c,p4) and ma(c,p4) > ma(c,p5) then value = 1; else value = 0; if value == 1 and value[1] != 1 then{ idx = index(); cval = C; } if index() == idx+p2 and C > Cval+p1 then buy(); if crossdown(c,ma(c,p4)) then exitlong(); if ma(c,p3) < ma(c,p4) and ma(c,p4) < ma(c,p5) then value = 3; else value = 0; if value == 3 and value[1] != 3 then{ idx2 = index(); cval2 = C; } if index() == idx2+p7 and C < Cval2-p6 then sell(); if crossup(c,ma(c,p4)) then exitshort();
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2006-03-07 13:16:12

안녕하세요 예스스탁입니다. 매수/매수청산만 적용할 경우와 매수/매수청산/매도/매도청산을 적용할 경우 결과가 다를 수 있습니다. 매수/매수청산만 적용할 경우 매수-매수청산-무포지션-매수-매수청산-무포지션을 반복하지만 매수/매수청산/매도/매도청산식을 적용할 경우 매수 후 매수청산으로 청산될 수도 잇으며 매수 후 매도에 의해 반대포지션인 매수가 청산될수도 있습니다. 반대로 매도 후 매수에 의해 반대포지션인 매도가 청산될수도 있습니다. 각 매도진입과 매수진입이 반대포지션이 청산 완료후에 진입할 수 있게 식을 수정했습니다. 진입식에 marketposition() == 0 (무포지션)을 추가해서 청산이 완료된 후에 다음 진입이 들어갈 수 있게 했습니다. input: p1(0.5);//매수상승폭 input: p2(10);//매수 봉의 갯수 input: p3(5); input: p4(20); input: p5(60); input: p6(0.5);//매도 하락폭 input: p7(10);//매도 봉의 갯수 var : value(0),idx(0),Cval(0), idx2(0), cval2(0); if ma(c,p3) > ma(c,p4) and ma(c,p4) > ma(c,p5) then value = 1; else value = 0; if value == 1 and value[1] != 1 then{ idx = index(); cval = C; } if marketposition() == 0 and index() == idx+p2 and C > Cval+p1 then buy(); if crossdown(c,ma(c,p4)) then exitlong(); if ma(c,p3) < ma(c,p4) and ma(c,p4) < ma(c,p5) then value = 3; else value = 0; if value == 3 and value[1] != 3 then{ idx2 = index(); cval2 = C; } if marketposition() == 0 and index() == idx2+p7 and C < Cval2-p6 then sell(); if crossup(c,ma(c,p4)) then exitshort(); 즐거운 하루되세요 > 알파 님이 쓴 글입니다. > 제목 : 수식 문의 > 정배열시 일정봉(10)지날때까지 일정금액(0.5)이 상승하면 매수 역배열시 일정봉 지날때까지 일정금액이 하락하면 매도 기본적으로 위의 식인데 식의 어디가 잘못된 건지 알수가 없네요 -매수만 적용할때와 매수매도식을 동시에 적용할때 결과가 다르게 나옵니다 부탁드립니다 감사합니다 input: p1(0.5);//매수상승폭 input: p2(10);//매수 봉의 갯수 input: p3(5); input: p4(20); input: p5(60); input: p6(0.5);//매도 하락폭 input: p7(10);//매도 봉의 갯수 var : value(0),idx(0),Cval(0), idx2(0), cval2(0); if ma(c,p3) > ma(c,p4) and ma(c,p4) > ma(c,p5) then value = 1; else value = 0; if value == 1 and value[1] != 1 then{ idx = index(); cval = C; } if index() == idx+p2 and C > Cval+p1 then buy(); if crossdown(c,ma(c,p4)) then exitlong(); if ma(c,p3) < ma(c,p4) and ma(c,p4) < ma(c,p5) then value = 3; else value = 0; if value == 3 and value[1] != 3 then{ idx2 = index(); cval2 = C; } if index() == idx2+p7 and C < Cval2-p6 then sell(); if crossup(c,ma(c,p4)) then exitshort();