커뮤니티
청산명으로 재진입 제어
2014-04-21 11:10:35
159
글번호 74559
특정 청산명으로(이경우 "ts" 입니다.) 청산후 당일 재진입을 제어하기 위한 수식입니다. 현재로서는 제어가 되지않고 재진입이 발생 합니다. 수식은 다음과 같습니다.
Var : count(0), cnt(0), bcount(0), scount(0), excount(0) ;
Input : p(0.005);
bcount=0;
scount=0;
excount=0;
For cnt=0 To 20{
If sdate == EntryDate(cnt) and MarketPosition(cnt)==1 Then
bcount=bcount+1;
If sdate == EntryDate(cnt) and MarketPosition(cnt)==-1 Then
scount=scount+1;
If sdate == ExitDate(cnt) and MarketPosition(cnt)==0 and ExitName(cnt)=="ts" Then
excount=excount+1;}
If bcount<2 and excount<1 Then{
buy("b",AtStop,100);}
ExitLong("bx",AtStop,99);
ExitLong("ts",AtStop,Highest(H,BarsSinceEntry)*(1-p));
답변 1
예스스탁 예스스탁 답변
2014-04-22 11:35:53
안녕하세요
예스스탁입니다.
If sdate == ExitDate(cnt) and MarketPosition(cnt)==0 and ExitName(cnt)=="ts" Then
for문에서 청산식 카운트 하는 조건중 MarketPosition(cnt)==0 부분이 잘못되었습니다.
이전진입이 무포지션이라는 내용으로 조건에 만족할수 없는 내용입니다.
해당 내용 제거 하시면 도비니다.
또한 진입식이 atstop이고 atstop은 현재봉 셋팅이 되어 다음봉에 시세조건만족하면 진입하므로
청산이 발생한 봉에 또 진입신호가 발생할수 있습니다,
그러므로 진입식에 무포지션일때만 셋팅이 되도록 하고
시세가 100이라는 가격아래에 있다가 처음 터치할때만 진입하게 조건을 추가해 주셔야 합니다.
기존에 작성하신 식에서는 ts로 청산하고 그때 가격이 100이상이면 또 즉시 진입하게 됩니다.
Var : count(0), cnt(0), bcount(0), scount(0), excount(0) ;
Input : p(0.005);
bcount=0;
scount=0;
excount=0;
For cnt=0 To 20{
If sdate == EntryDate(cnt) and MarketPosition(cnt)==1 Then
bcount=bcount+1;
If sdate == EntryDate(cnt) and MarketPosition(cnt)==-1 Then
scount=scount+1;
If sdate == ExitDate(cnt) and ExitName(cnt)=="ts" Then
excount=excount+1;
}
If MarketPosition == 0 and bcount < 2 and excount < 1 Then{
if H < 100 Then
buy("b",AtStop,100);
}
ExitLong("bx",AtStop,99);
ExitLong("ts",AtStop,Highest(H,BarsSinceEntry)*(1-p));
즐거운 하루되세요
> ft 님이 쓴 글입니다.
> 제목 : 청산명으로 재진입 제어
> 특정 청산명으로(이경우 "ts" 입니다.) 청산후 당일 재진입을 제어하기 위한 수식입니다. 현재로서는 제어가 되지않고 재진입이 발생 합니다. 수식은 다음과 같습니다.
Var : count(0), cnt(0), bcount(0), scount(0), excount(0) ;
Input : p(0.005);
bcount=0;
scount=0;
excount=0;
For cnt=0 To 20{
If sdate == EntryDate(cnt) and MarketPosition(cnt)==1 Then
bcount=bcount+1;
If sdate == EntryDate(cnt) and MarketPosition(cnt)==-1 Then
scount=scount+1;
If sdate == ExitDate(cnt) and MarketPosition(cnt)==0 and ExitName(cnt)=="ts" Then
excount=excount+1;}
If bcount<2 and excount<1 Then{
buy("b",AtStop,100);}
ExitLong("bx",AtStop,99);
ExitLong("ts",AtStop,Highest(H,BarsSinceEntry)*(1-p));