- ago
Hello,

I'm trying to replicate the Choppiness indicator in my custom code, but I found many different formulas over internet. The Word document link at https://www2.wealth-lab.com/WL5Wiki/Choppiness.ashx is dead.

Can you kindly provide me with the formula that is used in Wealth-Lab? Or may be a link to an article you used as the reference?

Thank you!
0
119
Solved
4 Replies

Reply

Bookmark

Sort
- ago
#1
Even if a link is dead it can sometimes be resurrected. Leaving the complete link here won't work so you'll have to make some work yourself:

1. Enter the Wayback Machine:

http://web.archive.org/

2. Copy the now dead link from the Wiki:

www.jamesgoulding.com/Research_II/Chaos Theory/Chaos Theory (Measuring market choppiness with).doc

3. Paste it into the internet archive and browse to the latest snapshot's date in 2019.

4. Click on the snapshot link to download. Voila.
0
Cone8
 ( 7.72% )
- ago
#2
That wayback doc gives you a doc that ends with another link you cannot access by Wayback Machine:

A spreadsheet showing how the Choppiness Index is calculated can be found here (but not anymore): ftp://ftp.io.com/pub/usr/gibbonsb/futures/pc/CHOPPY.XLS

A web search for the formula for choppiness gives plenty of hits that all seem to give this equation, worked out for WealthLab -

CODE:
int n = 14; TimeSeries dci = 100 * TimeSeries.Log(ATR.Series(bars, 14).Sum(n) / (Highest.Series(bars.High, n) - Lowest.Series(bars.Low, n))) / Math.Log(n); PlotTimeSeries(dci, "Choppiness", "ChoppyPane");
It rhymes with WealthLab's formulation, which is plenty good for all practical purposes. Just use the one you like best.

WealthLab's current formulation, simplified. Ignore data at the beginning of the serioes up to about bar n, the period.
CODE:
int n = 14; TimeSeries tH = new TimeSeries(bars.DateTimes, true); TimeSeries tL = new TimeSeries(bars.DateTimes, true); for (int bar = 1; bar < bars.Count ; bar++) {    double C1 = bars.Close[bar - 1];    tH[bar] = C1 > bars.High[bar] ? C1 : bars.High[bar];    tL[bar] = C1 < bars.Low[bar] ? C1 : bars.Low[bar]; }          TimeSeries dciWL = 100 * TimeSeries.Log(TR.Series(bars).Sum(n) / (Highest.Series(tH, n) - Lowest.Series(tL, n))) / Math.Log(n);

Differences
1. does not use ATR. It sums the TR of the period and divides by the period. (ATR uses the WilderMA).
2. uses the Highest/Lowest of the TR High/Low, not of the High/Low series.

I'll add that to the indicator's doc (and update WL's indicator since there's a problem at the initialization with the current formula).
3
Best Answer
Cone8
 ( 7.72% )
- ago
#3
fyi, indicator formula updated above just now.
1
- ago
#4
If I'm reading the Post #2 formula right, we are looking at the ratio of two True Ranges.

choppiness = Log[ TR(n=2)/TR(n=n) ]

I appreciate why we are using True Range as the volatility measurement over the usual standard deviation [stdDev = Sqrt(variance)], but I have to wonder if robust statistics offers a better way?
0

Reply

Bookmark

Sort