Quote from MGJ:
While rushing to slap something together, you modified the Bollinger Band Breakout Classic system, but forgot to modify the variable name. So you're calculating AverageRange but incorrectly calling it StandardDeviation. Sloppy work, unworthy of "The Einstein of Wall Street" http://bit.ly/lEOhL1
Your correct , I started with a Bollinger Band Breakout Classic systemand modified it. I just copied it from my working directory and did not modify it. But just to clarify the logic is correct just the name is misleading.
If you were careful you would of noticed the EQLB parameter and virprofit variables. I removed that logic because I am going to cover equity curve feedback in a few posts with this system after I discuss the optimization. Leaving that was sloppy, but I wanted to start this thread moving toward some useful stuff for members and started with the completed system and edited out stuff so I can build it in layers and give the effect of the steps I went though building it.
Corrected Code
Sub KeltnerBBreakOutClassic(SLen,BandMult)
Dim MAAve As BarArray
Dim RangeAve As BarArray
MAAve=Average(Close,SLen,0)
RangeAve=Average(Range,SLen,0)
If Close>MAAve+BandMult*RangeAve Then Buy("LE",1,0,Market,Day)
If Close<MAAve-BandMult*RangeAve Then Sell("SE",1,0,Market,Day)
If MarketPosition=1 And Close<MAAve Then ExitLong("LX","LE",1,0,Market,Day)
If MarketPosition=-1 And Close>MAAve Then ExitShort("SX","SE",1,0,Market,Day)
'***********************************************************************
marketbreakdown2()
'**********************************************************************
End Sub