커뮤니티
진입조건에 따른 청산
2006-03-06 13:55:33
1288
글번호 9536
진입조건에 따른 청산에 대해 문의드립니다.
수식이 아래와 같을때 매수에 대한 청산(0)은 나오는데 매도에 대한 청산(0)이 안나옵니다.뭐가 잘못됐는지요?
var : Cond1(0), Cond2(0), Cond3(0), Cond4(0), Cond5(0), Cond6(0),
Cond11(0), Cond22(0), Cond33(0), Cond44(0), Cond55(0), Cond66(0),
buyCond(0), sellCond(0);
Cond1 = crossup(C, dayopen(0)+0.3); //매수조건1
Cond2 = crossup(C, dayopen(0)+0.6); //매수조건2
Cond3 = crossup(C, dayopen(0)+0.9); //매수조건3
Cond4 = crossdown(C, dayopen(0)-0.3); //매수청산조건1
Cond5 = crossdown(C, dayopen(0)+0.3); //매수청산조건2
Cond6 = crossdown(C, dayopen(0)+0.6); //매수청산조건3
Cond11 = crossdown(C, dayopen(0)-0.3); //매도조건1
Cond22 = crossdown(C, dayopen(0)-0.6); //매도조건2
Cond33 = crossdown(C, dayopen(0)-0.9); //매수조건3
Cond44 = crossup(C, dayopen(0)+0.3); //매도청산조건1
Cond55 = crossup(C, dayopen(0)-0.3); //매도청산조건2
Cond66 = crossup(C, dayopen(0)-0.6); //매도청산조건3
if date != date[1] then
buyCond = 0;
//매수식
if MarketPosition() != 1 then Begin
if Cond1 then {
buy("1");
buyCond = 1;
}
else if Cond2 then {
buy("2");
buyCond = 2;
}
else if Cond3 then {
buy("3");
buyCond = 3;
}
End;
//매수청산식
if marketposition() == 1 then Begin
if buyCond == 1 and Cond4 then
exitlong("4");
End;
if marketposition() == 1 then Begin
if buyCond == 2 and Cond5 then
exitlong("5");
End;
if marketposition() == 1 then Begin
if buyCond == 3 and Cond6 then
exitlong("6");
End;
//매도식
if date != date[1] then
sellCond = 0;
if MarketPosition() != -1 then Begin
if Cond01 then {
sell("11");
sellCond = 11;
}
else if Cond02 then {
sell("22");
sellCond = 22;
}
else if Cond03 then {
sell("33");
sellCond = 33;
}
End;
//매도청산식
if marketposition() == -1 then Begin
if sellCond == 11 and Cond44 then
exitshort("44");
End;
if marketposition() == -1 then Begin
if sellCond == 22 and Cond55 then
exitshort("55");
End;
if marketposition() == -1 then Begin
if sellCond == 33 and Cond66 then
exitshort("66");
End;
답변 1
예스스탁 예스스탁 답변
2006-03-06 16:47:44
안녕하세요
예스스탁입니다.
식을 연결선물10분봉에 적용결과
매도청산식도 정상적으로 나오고 있습니다.
단지 매도포지션에 대해 매수진입에 의해 먼저청산을 하고 들어가는
경우가 더 많습니다.
즐거운 하루되세요
> 용이 님이 쓴 글입니다.
> 제목 : 진입조건에 따른 청산
> 진입조건에 따른 청산에 대해 문의드립니다.
수식이 아래와 같을때 매수에 대한 청산(0)은 나오는데 매도에 대한 청산(0)이 안나옵니다.뭐가 잘못됐는지요?
var : Cond1(0), Cond2(0), Cond3(0), Cond4(0), Cond5(0), Cond6(0),
Cond11(0), Cond22(0), Cond33(0), Cond44(0), Cond55(0), Cond66(0),
buyCond(0), sellCond(0);
Cond1 = crossup(C, dayopen(0)+0.3); //매수조건1
Cond2 = crossup(C, dayopen(0)+0.6); //매수조건2
Cond3 = crossup(C, dayopen(0)+0.9); //매수조건3
Cond4 = crossdown(C, dayopen(0)-0.3); //매수청산조건1
Cond5 = crossdown(C, dayopen(0)+0.3); //매수청산조건2
Cond6 = crossdown(C, dayopen(0)+0.6); //매수청산조건3
Cond11 = crossdown(C, dayopen(0)-0.3); //매도조건1
Cond22 = crossdown(C, dayopen(0)-0.6); //매도조건2
Cond33 = crossdown(C, dayopen(0)-0.9); //매수조건3
Cond44 = crossup(C, dayopen(0)+0.3); //매도청산조건1
Cond55 = crossup(C, dayopen(0)-0.3); //매도청산조건2
Cond66 = crossup(C, dayopen(0)-0.6); //매도청산조건3
if date != date[1] then
buyCond = 0;
//매수식
if MarketPosition() != 1 then Begin
if Cond1 then {
buy("1");
buyCond = 1;
}
else if Cond2 then {
buy("2");
buyCond = 2;
}
else if Cond3 then {
buy("3");
buyCond = 3;
}
End;
//매수청산식
if marketposition() == 1 then Begin
if buyCond == 1 and Cond4 then
exitlong("4");
End;
if marketposition() == 1 then Begin
if buyCond == 2 and Cond5 then
exitlong("5");
End;
if marketposition() == 1 then Begin
if buyCond == 3 and Cond6 then
exitlong("6");
End;
//매도식
if date != date[1] then
sellCond = 0;
if MarketPosition() != -1 then Begin
if Cond01 then {
sell("11");
sellCond = 11;
}
else if Cond02 then {
sell("22");
sellCond = 22;
}
else if Cond03 then {
sell("33");
sellCond = 33;
}
End;
//매도청산식
if marketposition() == -1 then Begin
if sellCond == 11 and Cond44 then
exitshort("44");
End;
if marketposition() == -1 then Begin
if sellCond == 22 and Cond55 then
exitshort("55");
End;
if marketposition() == -1 then Begin
if sellCond == 33 and Cond66 then
exitshort("66");
End;