Here is the code for the system that I used to generate the results I showed earlier.
'********************************
' IndexSys Mult is % of range off of the open and SType is either range or truerange
' 0 is range and 1 is truerange
' The system also exits all trades after five days
' TradersStudio(r) copyright 2004-2011, All rights reserved
Sub IndexSys(Mult,SType)
Dim Nxtopen
Dim MyRange As BarArray
Nxtopen=NextOpen(0)
If SType=0 Then
MyRange=Range
Else
MyRange=TrueRange
End If
' We do not have a NextOpen on the last bar so we need to set it to zero
' This way the active order is reported as a change off of the open
If BarNumber=LastBar Then
Nxtopen=0
End If
If Close>Open Then
Sell("SellBrk",1,Nxtopen-Mult*Average(MyRange,3,0),Stop,Day)
End If
If Close<Open Then
Buy("BuyBrk",1,Nxtopen+Mult*Average(MyRange,3,0) ,Stop,Day)
End If
If BarsSinceEntry>5 And MarketPosition=1 Then
ExitLong("TimeLong","BuyBrk",1,0,Market,Day)
End If
If BarsSinceEntry>5 And MarketPosition=-1 Then
ExitShort("TimeShort","SellBrk",1,0,Market,Day)
End If
End Sub