← Script Marketplace
Open-source scriptindicator/v1

Choppiness Index

by Kodexius·@kodexius·

Compare accumulated true range with the total price range to quantify trend versus consolidation.

#choppiness#oscillator#trend
Choppiness Index chart preview

Description

The Choppiness Index uses a logarithmic ratio between summed true range and the high-low range. Higher readings indicate more overlapping, range-bound movement, while lower readings indicate that price has moved more directionally.

Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.

Release notes

Version history · 1 published version

Version 1CurrentChart updatedChoppiness Index · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Choppiness Index", { overlay: false });
const length = input.int("Length", 14, { min: 2, max: 200 });
const ranges = tr();
const hi = highest(high, length);
const lo = lowest(low, length);
const line = close.map((_, i) => {
  if (i < length - 1) return NaN;
  let total = 0;
  for (let j = i - length + 1; j <= i; j++) total += ranges[j];
  const span = hi[i] - lo[i];
  return span <= 0 ? 100 : 100 * Math.log10(total / span) / Math.log10(length);
});
plot(line, { title: "CHOP", color: "#2962ff", lineWidth: 2 });
hline(61.8, { title: "Choppy", color: "#ef5350", style: "dashed" });
hline(38.2, { title: "Trending", color: "#26a69a", style: "dashed" });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.