커뮤니티
수식문의합니다.
2004-04-20 13:10:00
1521
글번호 3287
전일 횡보구간이 있을 경우 전일횡보구간의 고점위에서는 매수
전일횡보구간의 저점아래서는 매도하는 식인데 10분봉 선물연결지수에 당일청산조건으로 실행해 보니 무수한 거래가 이루어지는데 원인을몰라요. 돌겠어요.
var : cond(0), preCond(0), Hval(0), Lval(0),
preHval(0), preLval(0), nontrend(0);
if date <> date[1] then {
cond = false;
preCond = cond[1];
}
Hval = highest(c,12);
Lval = lowest(c,12);
if Hval - Lval < 0.4 then
nontrend = true;
else
nontrend = false;
if nontrend == true then {
preHval = Hval;
preLval = Lval;
cond = true;
}
if c>prehval&&precond==true then
buy();
exitshort();
if c<prelval&&precond==true then
sell();
exitlong();
답변 1
예스스탁 예스스탁 답변
2004-04-20 14:29:05
안녕하세요..
이 부분을 수정해 주시면 됩니다.
괄호를 묶지 않을 경우 exitshort이나 exitlong은 if문의 조건에 상관없이 모든 봉에서 실행됩니다. 즉 진입신호가 발생된 다음봉에서 바로 청산신호가 발생하게 됩니다.
if c>prehval&&precond==true then {
buy();
exitshort();
}
if c<prelval&&precond==true then {
sell();
exitlong();
}
이 식은 청산과 동시에 진입이 발생하는 식이므로 다음과 같이 작성해도 됩니다.
var : cond(0), preCond(0), Hval(0), Lval(0),
preHval(0), preLval(0), nontrend(0);
if date <> date[1] then {
cond = false;
preCond = cond[1];
}
Hval = highest(c,12);
Lval = lowest(c,12);
if Hval - Lval < 0.4 then
nontrend = true;
else
nontrend = false;
if nontrend == true then {
preHval = Hval;
preLval = Lval;
cond = true;
}
if c>prehval&&precond==true then
buy();
if c<prelval&&precond==true then
sell();
> freeman 님이 쓴 글입니다.
> 제목 : 수식문의합니다.
> 전일 횡보구간이 있을 경우 전일횡보구간의 고점위에서는 매수
전일횡보구간의 저점아래서는 매도하는 식인데 10분봉 선물연결지수에 당일청산조건으로 실행해 보니 무수한 거래가 이루어지는데 원인을몰라요. 돌겠어요.
var : cond(0), preCond(0), Hval(0), Lval(0),
preHval(0), preLval(0), nontrend(0);
if date <> date[1] then {
cond = false;
preCond = cond[1];
}
Hval = highest(c,12);
Lval = lowest(c,12);
if Hval - Lval < 0.4 then
nontrend = true;
else
nontrend = false;
if nontrend == true then {
preHval = Hval;
preLval = Lval;
cond = true;
}
if c>prehval&&precond==true then
buy();
exitshort();
if c<prelval&&precond==true then
sell();
exitlong();