Appearance
Choppiness Index
Choppiness: high when the market ranges, low when it trends.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Choppiness Index under Trend. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Length | int | 14 |
| Color | color | "#2962FF" |
Source
From packages/alphascript/indicators/chop.as.js.
js
indicator({ name: "Choppiness Index", shortTitle: "CHOP", overlay: false, precision: 2 });
const length = input.int("Length", 14, { min: 2 });
const atrSum = ta.sum(ta.atr(1), length), hh = ta.highest(candle.high, length), ll = ta.lowest(candle.low, length);
plot(ta.calc([atrSum, hh, ll], (a, h, l) => (100 * math.log(a / (h - l))) / math.log(length)), { title: "CHOP", color: input.color("Color", "#2962FF", { group: "Style" }) });
hline(61.8, { title: "Upper band", color: "#787B86", style: "dashed" });
hline(50, { title: "Middle band", color: "rgba(120,123,134,0.5)", style: "dotted" });
hline(38.2, { title: "Lower band", color: "#787B86", style: "dashed" });
fill(61.8, 38.2, { title: "Background", color: "rgba(33,150,243,0.1)" });