Registered User Joined: 6/10/2014 Posts: 2
|
Hey,
How would I be able to add the choppiness index as a indictor in Stockfinder? I know the formula that was given for TC2000 in another thread but that doesn't work with Stockfinder of course.
Thank you!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following RealCode Indicator.
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.1 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Choppiness Index
'|******************************************************************
'# Period = UserInput.Integer = 14
Static Sum As Single
Static Den As Single
If isFirstBar Then
Sum = 0
Den = Math.Log(Period)
Else
Sum += Math.Max(Price.High, Price.Last(1)) - _
Math.Min(Price.Low, Price.Last(1))
End If
If CurrentIndex >= Period Then
Plot = 100 * Math.Log(Sum / _
(Math.Max(Price.MaxHigh(Period), Price.Last(Period)) - _
Math.Min(Price.MinLow(Period), Price.Last(Period)))) / Den
Sum -= Math.Max(Price.High(Period - 1), Price.Last(Period)) - _
Math.Min(Price.Low(Period - 1), Price.Last(Period))
Else
Plot = Single.NaN
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 6/10/2014 Posts: 2
|
Awesome, thank you Bruce!
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|