From the February 01, 2011 issue of Futures Magazine • Subscribe!

Additional Codes

CLOSE RANGE BREAKOUT

This opening range breakout system — with a built-in trend filter — manufactures an opening price for reference.

Sub CloseRangeBreakout(RePointNumber,Mult,Misc,Hold)

Dim Center As BarArray

Dim HLRatio As BarArray

If RePointNumber=-1 Then

Center=NextOpen(0)

End If

If RePointNumber=0 Then

Center=Close

End If

If RePointNumber=1 Then

Center=(High+Low+Close)/3

End If

If RePointNumber=2 Then

If High-Low<>0 Then

HLRatio=(Close-Low)/(High-Low)

Else

HLRatio=.5

End If

If HLRatio>.7 Then

Center=Close-Misc*Range

End If

If HLRatio<.3 Then

Center=Close+Misc*Range

End If

End If

If RePointNumber=3 Then

Center=Close+Misc*Range

End If

' Commented out will be uncommented and be enabled for in some tests

'If CloseClose[40] Then Buy("LE",1,Center+Mult*Average(TrueRange,3,0),Stop,Day)

'If Close>Close[1] And CloseMult*Average(TrueRange,3,0),Stop,Day)

Buy("LE",1,Center+Mult*Average(TrueRange,3,0),Stop,Day)

Sell("SE",1,Center-Mult*Average(TrueRange,3,0),Stop,Day)

If BarsSinceEntryplus("LE")>Hold And marketposition=1 Then

ExitLong("LXTime","LE",1,Close,Limit,Day)

End If

If BarsSinceEntryplus("SE")>Hold And marketposition=-1 Then

ExitShort("SXTime","SE",1,Close,Limit,Day)

End if

'ExitShort("SX","SE",1,Center+Mult*Average(TrueRange,3,0),Stop,Day)

'ExitLong("LX","LE",1,Center-Mult*Average(TrueRange,3,0),Stop,Day)

marketbreakdown2()

End Sub

Comments
comments powered by Disqus