커뮤니티
궁금...
2012-04-09 13:47:28
387
글번호 49859
Input: len1(25), len2(6), s1(0.37), s2(2.7), level(50);
var : cond1(false),cond2(false);
Var1=slowk(len1,len2);
If sdate<>sdate[1] then{
Var10=9999999;
Var11=0;
Var50=totaltrades;
Cond1=False;
Cond2=False;
}
If crossup(Var1,level) then{
Var10=high;
}
If crossdown(Var1,level) then{
Var11=low;
}
Cond1=crossup(Var1, level);
Cond2=CrossDown(Var1, level);
If totaltrades-var50==0 then{
If stime<150000 then{
If opend(0)< closed(1) then{
buy("매수",Atstop,Var10);
}
If opend(0)> closed(1) then{
sell("매도", Atstop,Var11);
}
If Var1>level then{
buy("매수1",Atstop,opend(0)+(highd(1)-lowd(1))*s1);
}
If Var1<level then{
sell("매도1",Atstop,opend(0)-(highd(1)-lowd(1))*s1);
}
}
}
If MarketPosition<>0 then{
exitlong("매수추적",Atstop,Highest(high,barssinceentry+1) - atr(20)*s2);
exitshort("매도추적",Atstop,Lowest(low,barssinceentry+1)+atr(20)*S2);
}
If Cond2 then{
exitlong("지표청산1",Atstop,lowest(low,3));
}
If Cond1 then{
exitshort("지표청산2",Atstop,highest(high,3));
}
SetStopEndofday(150400);
하루 한번만 진입을 하려고 totaltrades-var50==0 값을 넣었는데
한봉에서 청산을 하고 바로 다시 진입이 들어가 버리네요..
어떻게 해결하나요??
- 1. 50213_11.jpg (0.21 MB)
답변 1
예스스탁 예스스탁 답변
2012-04-09 14:40:28
안녕하세요
예스스탁입니다.
작성된 대신 수식의 당일 진입횟수를 카운트 하는 방식이
전일까지의 총거래에서 현재 거래횟수의 차이를 보는내용이고
청산까지 완료되어야 하나의 거래로 인식을 하므로
발생하는 내용입니다.
아래와 같은 당일진입횟수를 계산하는 내용을 추가해서
식에서 제어하시면 됩니다.
Input: len1(25), len2(6), s1(0.37), s2(2.7), level(50);
var : cond1(false),cond2(false),count(0),cnt(0);
#당일진입횟수 카운트
count = 0;
for cnt = 0 to 10{
if EntryDate(cnt) == sdate Then
count = count+1;
}
Var1=slowk(len1,len2);
If sdate<>sdate[1] then{
Var10=9999999;
Var11=0;
Var50=totaltrades;
Cond1=False;
Cond2=False;
}
If crossup(Var1,level) then{
Var10=high;
}
If crossdown(Var1,level) then{
Var11=low;
}
Cond1=crossup(Var1, level);
Cond2=CrossDown(Var1, level);
If count==0 then{
If stime<150000 then{
If opend(0)< closed(1) then{
buy("매수",Atstop,Var10);
}
If opend(0)> closed(1) then{
sell("매도", Atstop,Var11);
}
If Var1>level then{
buy("매수1",Atstop,opend(0)+(highd(1)-lowd(1))*s1);
}
If Var1<level then{
sell("매도1",Atstop,opend(0)-(highd(1)-lowd(1))*s1);
}
}
}
If MarketPosition<>0 then{
exitlong("매수추적",Atstop,Highest(high,barssinceentry+1) - atr(20)*s2);
exitshort("매도추적",Atstop,Lowest(low,barssinceentry+1)+atr(20)*S2);
}
If Cond2 then{
exitlong("지표청산1",Atstop,lowest(low,3));
}
If Cond1 then{
exitshort("지표청산2",Atstop,highest(high,3));
}
SetStopEndofday(150400);
즐거운 하루되세요
> rlaxoeh 님이 쓴 글입니다.
> 제목 : 궁금...
> Input: len1(25), len2(6), s1(0.37), s2(2.7), level(50);
var : cond1(false),cond2(false);
Var1=slowk(len1,len2);
If sdate<>sdate[1] then{
Var10=9999999;
Var11=0;
Var50=totaltrades;
Cond1=False;
Cond2=False;
}
If crossup(Var1,level) then{
Var10=high;
}
If crossdown(Var1,level) then{
Var11=low;
}
Cond1=crossup(Var1, level);
Cond2=CrossDown(Var1, level);
If totaltrades-var50==0 then{
If stime<150000 then{
If opend(0)< closed(1) then{
buy("매수",Atstop,Var10);
}
If opend(0)> closed(1) then{
sell("매도", Atstop,Var11);
}
If Var1>level then{
buy("매수1",Atstop,opend(0)+(highd(1)-lowd(1))*s1);
}
If Var1<level then{
sell("매도1",Atstop,opend(0)-(highd(1)-lowd(1))*s1);
}
}
}
If MarketPosition<>0 then{
exitlong("매수추적",Atstop,Highest(high,barssinceentry+1) - atr(20)*s2);
exitshort("매도추적",Atstop,Lowest(low,barssinceentry+1)+atr(20)*S2);
}
If Cond2 then{
exitlong("지표청산1",Atstop,lowest(low,3));
}
If Cond1 then{
exitshort("지표청산2",Atstop,highest(high,3));
}
SetStopEndofday(150400);
하루 한번만 진입을 하려고 totaltrades-var50==0 값을 넣었는데
한봉에서 청산을 하고 바로 다시 진입이 들어가 버리네요..
어떻게 해결하나요??
다음글
이전글