OPEN-SOURCE SCRIPT

Choppiness Index | CipherDecoded

305
The Choppiness Index is a multi-timeframe regime indicator that measures whether price action is trending or consolidating.

This recreation was inspired by the Choppiness Index chart from Checkonchain, with full credit to their team for the idea.

🔹How It Works
Pine Script®
CI = 100 * log10( SUM(ATR(1), n) / (highest(high, n) – lowest(low, n)) ) / log10(n)

Where:
  • n – lookback length (e.g. 14 days / 10 weeks / 10 months)
  • ATR(1) – true-range of each bar
  • SUM(ATR(1), n) – total true-range over n bars
  • highest(high, n) and lowest(low, n) – price range over n bars
  • Low values → strong trend
  • High values → sideways consolidation

Below is a simplified function used in the script for computing CI on any timeframe:
Pine Script®
f_ci(_n) => _tr = ta.tr(true) _sum = math.sum(_tr, _n) _hh = ta.highest(high, _n) _ll = ta.lowest(low, _n) _rng = _hh - _ll _rng > 0 ? 100 * math.log10(_sum / _rng) / math.log10(_n) : na

  1. Consolidation Threshold — 50.0
  2. Trend Threshold — 38.2
  • When Weekly CI < Trend Threshold, a trending zone (yellow) appears.
  • When Weekly CI > Consolidation Threshold, a consolidation zone (purple) appears.
  • Users can toggle either background independently.

🔹Example Background Logic
Pine Script®
bgcolor(isTrend and Trend ? color.new(#f3e459, 50) : na, title = "Trending", force_overlay = true) bgcolor(isConsol and Cons ? color.new(#974aa5, 50) : na, title = "Consolidation", force_overlay = true)


🔹Usage Tips
  • Observe the Weekly CI for regime context.
  • Combine with price structure or trend filters for signal confirmation.
  • Low CI values (< 38) indicate strong trend activity — the market may soon consolidate to reset.
  • High CI values (> 60) reflect sideways or range-bound conditions — the market is recharging before a potential new trend.


🔹 Disclaimer
This indicator is provided for educational purposes.
No trading outcomes are guaranteed.
This tool does not guarantee market turns or performance; it should be used as part of a broader system.
Use responsibly and perform your own testing.

🔹 Credits
Concept origin — Checkonchain Choppiness Index

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.