Registered User Joined: 1/5/2007 Posts: 21
|
Hello. Mathmatically, I'm looking for StandardDeviation(TradeRange(5)). I have looked at StdDev realcode, but have no conclusion how to get what I want. Can you help?
Many Thanks!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Standard Deviation of Range
'|******************************************************************
'# Period = UserInput.Integer = 5
Static SumC As Single
Static SumSq As Single
If isFirstBar Then
SumC = 0
SumSq = 0
End If
SumC += Price.High - Price.Low
SumSq += (Price.High - Price.Low) ^ 2
If CurrentIndex >= Period Then
SumC -= Price.High(Period) - Price.Low(Period)
SumSq -= (Price.High(Period) - Price.Low(Period)) ^ 2
End If
If CurrentIndex >= Period - 1 Then
Plot = Math.Abs((SumSq - SumC ^ 2 / Period) / Period) ^ .5
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 1/5/2007 Posts: 21
|
Thanks Bruce! I continue to learn from your examples.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|