//+------------------------------------------------------------------+ /*| Choppiness Index (CHOP) - Tradingview Wiki | //| www.tradingview.com/wiki/Choppiness_Index_(CHOP) | //+------------------------------------------------------------------+ 100 * LOG10( SUM(ATR(1), n) / ( MaxHi(n) - MinLo(n) ) ) / LOG10(n) n = User defined period length. LOG10(n) = base-10 LOG of n ATR(1) = Average True Range (Period of 1) SUM(ATR(1), n) = Sum of the Average True Range over past n buffers MaxHi(n) = The highest high over past n buf[] */ double Chop(COUNT n, INDEX s=0){ return Chop(_Symbol, PERIOD_CURRENT, n, s);} double Chop(ENUM_TIMEFRAMES tf, COUNT n, INDEX s=0){ return Chop(_Symbol, tf, n, s);} double Chop(SYMBOL sym, ENUM_TIMEFRAMES tf, COUNT n, INDEX s=0){ PRICE HH = iHigh(sym, tf, iHighest(sym, tf, MODE_HIGH, n, s) ); PRICE LL = iLow(sym, tf, iLowest(sym, tf, MODE_LOW, n, s) ); CHANGE Eatr = 0.0; for(COUNT i=n; i>0;--i) Eatr += iATR(sym, tf, 1, s++); return 100 * log10(Eatr / (HH-LL)) / log10(n); }
William Roeder:
Thanks for your suggested solution; however, it didn't work as it's throwing some errors, have you had a chance to test it?
It worked fine when I wrote the indicator five years ago.
William Roeder:
It worked fine when I wrote the indicator five years ago.
I had to make some changes to make it work. Thanks a lot anyway!
It worked fine when I wrote the indicator five years ago.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Using Pinescript on TradingView, I was able to simply do the following:
I found an MT4 indicator but didn't know how to extract the function :
https://forex-station.com/app.php/attach/file/3316129