Choppiness Index (CHOP)
Summary
Choppiness Index: a trend-versus-consolidation gauge, the true range travelled over a window against the height of the box its bars span. Devised by Bill Dreiss. Log-scaled so that a straight run reads 0 and bars that each fill the whole box read 100. Like ADX and VHF it measures whether the market is trending, not in which direction: low values mean a directional run, high values sideways chop.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive·levels: 38.2, 61.8
Formula
TR[j] = max(High[j], Close[j-1]) - min(Low[j], Close[j-1]), the true range.
S = SUM( TR[j] ) and R = MAX( High[j] ) - MIN( Low[j] ), both over j = t-optInTimePeriod+1 .. t.
CHOP = 100 * log10( S / R ) / log10( optInTimePeriod ).
The first true range reads the close one bar before the window, so the first value needs optInTimePeriod + 1 bars.
Notes
- The box is the window's highest high minus its lowest low. The 1993 publication instead spans the highest true high and the lowest true low, which also reach the close just before each bar; that form is CHOPTR. The two differ only on bars where the close before the window lies outside the window's high-low range: a gap into the window.
- Because a gap into the window adds to the true range but not to the box, CHOP has no upper bound and can exceed 100.
- A window with no box height, or no true range, reports 100.
- Dreiss's 3-bar smoothing of the index is not built in; apply a moving average to
outRealto obtain it.
Inputs
inHigh— High price of each barinLow— Low price of each barinClose— Close price of each bar
Outputs
outReal— Choppiness Index value
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 14 | 2–100000 | Number of bars in the window |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ✅ Uses Transcendental i |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double high[252]; /* your data, oldest first */
double low[252]; /* your data, oldest first */
double close[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_CHOP( 0, n - 1, high, low, close, 14, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d; last out = %f\n", outNBElement, outBegIdx, out[outNBElement - 1] );use ta_lib::Core;
let high = vec![0.0; 252]; // your data, oldest first
let low = vec![0.0; 252]; // your data, oldest first
let close = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.chop(0, high.len() - 1, &high, &low, &close, 14, &mut out)?;
println!("{} values from bar {}; last out = {}", range.count, range.beg_idx, out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
double[] high = new double[252]; // your data, oldest first
double[] low = new double[252]; // your data, oldest first
double[] close = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.chop(0, high.length - 1, high, low, close, 14, out);
System.out.println(r.count() + " values from bar " + r.begIdx() + "; last out = " + out[r.count() - 1]);using System;
using TALib;
var high = new double[252]; // your data, oldest first
var low = new double[252]; // your data, oldest first
var close = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Chop(0, high.Length - 1, high, low, close, 14, outReal);
Console.WriteLine($"{r.Count} values from bar {r.BegIdx}; last outReal = {outReal[r.Count - 1]}");import { chop } from 'ta-lib';
const high = new Float64Array(252); // your data, oldest first
const low = new Float64Array(252); // your data, oldest first
const close = new Float64Array(252); // your data, oldest first
const { begIdx, values } = chop({ high, low, close }, { timePeriod: 14 });
console.log(values.length + ' values from bar ' + begIdx + '; last values = ' + values[values.length - 1]);Implementation
Added in 0.8.3 (ta-lib-python 0.8.3).
TA-Lib Definition: chop.c · chop.yaml
| Native | File |
|---|---|
| C | ta_CHOP.c |
| Rust | chop.rs |
| Java | Core_CHOP.java |
| C# | Core_CHOP.cs |
| TypeScript | chop.ts |
Python: talib.CHOP (ta-lib-python 0.8.3 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Choppiness Index, Dreiss Choppiness Index
See Also
References
- Gibbons Burke, "Measuring market choppiness with chaos", Futures, October 1993, pp. 52-53
- TradingView: Choppiness Index (CHOP)