SYSTEM TESTER - METASTOCK for NR7 is as follows
First create an indicator as below
NR7 {the name shud be only this}
RANGE:=H-L;
NR7:=If(RANGE<Ref(RANGE,-1) AND RANGE<Ref(RANGE,-2) AND RANGE<Ref(RANGE,-3) AND RANGE<Ref(RANGE,-4) AND RANGE<Ref(RANGE,-5) AND RANGE<Ref(RANGE,-6),1,0);
NR7
{Then create a metastock system tester - u can give ur own name}
Buy Order:
REF(Fml( "NR7"),-1) =1 and h>(0.05+ref(h,-1)) and REF(l,-1)> REF(Mov(c,5,s),-1)
{For profit stop we are using a trailing 5 period MA. Therfore We have included and REF(l,-1)> REF(Mov(c,5,s),-1) in order to avoid controvacies. i.e. we are not entering long is the low of the NR7 is lesser than 5 period MA. If anybody have better suggestion u can give}
Order type
STOP LIMIT
{We are doing all trades in stop loss basis only, If NR7 method gives a buy and yest high is 357.50, then we are giving a stop loss buying at 357.55, i.e. 0.05 paisa plus yest high}
Stop Price
0.05+REF(H,-1)
Expiration
Good gor Day
___________
Sell order
IF(REF( Fml( "NR7") ,-1)=1,l<(REF(L,-1)-0.05),l<REF(mov(c,5,s),-1))
{If yest is NR7 then we have bought today, our s/l is yest's low less 5 paise. In other cas, If we have entered yesterday or older then if the prices cuts 5 day MA(of yest) then we are closing by S/l. This will work as a trailing stop loss and also a profit stop. We will put stop loss in the mkt opening itself with trigger is yest's 5 day MA if we have entered yest or older. If we have entered today, i.e. if yest is NR7, We will put a stop loss at yest's low less 5 paisa.}
Order type Stop Limit
Stop Price: IF(REF( Fml( "NR7"),-1)=1,(REF(L,-1)-0.05) , REF(Mov(c ,5 ,s ),-1) )
Expiration
Good gor Day
__________________
Sell Short Order
REF(Fml( "NR7"),-1) =1 and L<(-0.05+ref(l,-1)) and REF(h,-1)< REF(Mov(c,5,s),-1)
Order type Stop Limit
Stop Price:
-0.05+REF(l,-1)
Expiration
Good gor Day
__________
Buy to Cover Order
IF(REF( Fml( "NR7") ,-1)=1,h>(REF(h,-1)+0.05),h>REF(mov(c,5,s),-1))
Order type: Stop Limit
Limt Price:
IF(REF( Fml( "NR7"),-1)=1,(REF(L,-1)-0.05) , REf(Mov(c ,5 ,s ),-1) )
Expiration
Good for Day
_____________________
All formulas are done in metastock 10.1 VErsion, but will work for older ver also. All codes are done with simplicity so that MEtastock 6.1 will even accept the codes. For ex, in NR7 indicator can be dome by LLV function. But it is not available in 6.1. You do all testing in your own metastock. All Price data are available freely. If u have any queries you are welcome.
All coding is based on post #4 of this thread with some modifications i discussed in my previous one or two of my posts in this thread.