SUTHERLAND
23rd August 2006, 05:50 PM
Hi I'm designing a volatility breakout system. My entry condition is H>ref(hhv(h,40),-1). I am looking to enter the market during the day when the price exceeds the prior HHV(H,40). Because there is a chance of the market gapping above the HHV on the open my entryprice is as follows: if(o>hhv(h,40),-1),o,ref(hhv(h,40),-1). My exittrigger is l<llv(l,20),-1) and because I also want to exit during the day my exitprice is: if(l<llv(l,20),-1,o,ref(llv(l,20),-1). My initial stop is; entryprice-3*ref(atr(10),-1). This is where I seem to pick up problems. When I test the system I get exit errors in the error log. It looks as though the system wants to exit on the llv(l,20) when the initial stop is breached instead at the initial stop value and that creates incorrect exits. Please help. The system in full looks like this:
entrytrigger:=H> Ref(HHV(H , 40),-1) ;
entryprice:=If(O>Ref(HHV(H,40),-1),O,Ref(HHV(H,40),-1));
exittrigger:=L<Ref(LLV(L,20),-1) ;
exitprice:=If(O<Ref(LLV(L,20),-1),O,Ref(LLV(L,20),-1));
initialstop:=entryprice-3*Ref(ATR(10),-1);
ExtFml("tradesim.initialize");ExtFml( "TradeSim.EnableProtectiveStop",0 );
ExtFml("tradesim.recordtrades",
" breakout",
long,
entrytrigger,
entryprice,
initialstop,
exittrigger,
exitprice,
start);
entrytrigger:=H> Ref(HHV(H , 40),-1) ;
entryprice:=If(O>Ref(HHV(H,40),-1),O,Ref(HHV(H,40),-1));
exittrigger:=L<Ref(LLV(L,20),-1) ;
exitprice:=If(O<Ref(LLV(L,20),-1),O,Ref(LLV(L,20),-1));
initialstop:=entryprice-3*Ref(ATR(10),-1);
ExtFml("tradesim.initialize");ExtFml( "TradeSim.EnableProtectiveStop",0 );
ExtFml("tradesim.recordtrades",
" breakout",
long,
entrytrigger,
entryprice,
initialstop,
exittrigger,
exitprice,
start);