Hi, I'm studying breakout system, I would like to know wich breakout system our community think It's better.
I'm particular interested on position sizing used in this system.
I have started to replicate the original (I hope)turtle system: I have find it really difficult for the position sizing formula.
I want to share the code, can be useful for someone
Buy on breakout 20 day ( size 33%) add 33% on breakout of (price of buy)+1N and the last 33% second buy point 1N
sell on breakout low 10 day, trailing stop 2N
(N=19 * PREVIOUS+ATR( 20))/20)
Do you think It' correct???
BUY:
buy:=H>Ref(HHV( H,20),-1) ;
sell:=L<Ref( LLV(L,10) ,-1) OR (C<(ValueWhen( 1,H>Ref(HHV( H,20),-1) ,L)-(2*Fml( "CTA_N turtle indicator")) ) ) ;
a:=Cum(buy);
b:=ValueWhen( 1,sell,a) ;
trades:=a-b;
BUY1:=If(TRADES> 0,1,0);
N1:=(ValueWhen( 1,TRADES= 1,C)+(1*Fml( "CTA_N turtle indicator")) );
Sbuy2:= (BUY1=1) AND H>N1;
CC:=Cum(SBUY2) ;
D:=ValueWhen( 1,sell,CC) ;
TRADES2:=CC- D;
BUY2:=If(TRADES2> 0,2,0);
N2:=(ValueWhen( 1,TRADES2= 1,C)+(1*Fml( "CTA_N turtle indicator")) );
Sbuy3:= (BUY2=2) AND H>N2;
EE:=Cum(SBUY3) ;
F:=ValueWhen( 1,sell,EE) ;
TRADES3:=EE- F;
BUY3:=If(TRADES3> 0,3,0);
long:=(TRADES= 1 and ref(trades,- 1)=0) OR (TRADES2=1 and ref(trades2, -1)=0) OR (TRADES3=1 and ref(trades3, -1)=0);
long
____________ ___
SELL:
L<Ref(LLV(L, 10),-1) OR (C<(ValueWhen( 1,H>Ref(HHV( H,20),-1) ,L)-(2*Fml( "CTA_N turtle indicator")) ) )
ENTRI SIZE: % of avaible Equity
buy:=H>Ref(HHV( H,20),-1) ;
sell:=L<Ref( LLV(L,10) ,-1) OR (C<(ValueWhen( 1,H>Ref(HHV( H,20),-1) ,L)-(2*Fml( "CTA_N turtle indicator")) ) ) ;
a:=Cum(buy);
b:=ValueWhen( 1,sell,a) ;
trades:=a-b;
BUY1:=If(TRADES> 0,1,0);
N1:=(ValueWhen( 1,TRADES= 1,C)+(1*Fml( "CTA_N turtle indicator")) );
Sbuy2:= (BUY1=1) AND H>N1;
CC:=Cum(SBUY2) ;
D:=ValueWhen( 1,sell,CC) ;
TRADES2:=CC- D;
BUY2:=If(TRADES2> 0,2,0);
N2:=(ValueWhen( 1,TRADES2= 1,C)+(1*Fml( "CTA_N turtle indicator")) );
Sbuy3:= (BUY2=2) AND H>N2;
EE:=Cum(SBUY3) ;
F:=ValueWhen( 1,sell,EE) ;
TRADES3:=EE- F;
BUY3:=If(TRADES3> 0,3,0);
trade:=if(BUY1= 1 and buy2=0,0.33, if( buy2=2 and buy3=0,0.5,if( buy1=1 and buy2=2 and buy3=0,0.66, if(buy3=3, 1,0))));
trade
(19 * PREVIOUS+ATR( 20))/20
BUY2:=If(TRADES2> 0,2,0);
N2:=(ValueWhen( 1,TRADES2= 1,C)+(1*Fml( "CTA_N turtle indicator")) );
Sbuy3:= (BUY2=2) AND H>N2;
EE:=Cum(SBUY3) ;
F:=ValueWhen( 1,sell,EE) ;
TRADES3:=EE- F;
BUY3:=If(TRADES3> 0,3,0);
long:=(TRADES= 1 and ref(trades,- 1)=0) OR (TRADES2=1 and ref(trades2, -1)=0) OR (TRADES3=1 and ref(trades3, -1)=0);
long
____________ ___
formula "CTA_N turtle indicator"
(19 * PREVIOUS+ATR( 20))/20