CCI measures how far the current typical price is from its moving average, normalized by the average absolute deviation. Despite the name it works on any market, not just commodities.
Formula
typical = (high + low + close) / 3
sma_tp = SMA(typical, period)
mean_dev = mean(|typical - sma_tp|, period)
cci = (typical - sma_tp) / (0.015 * mean_dev)The 0.015 constant is calibrated so roughly 70-80% of CCI readings
fall within ±100.
Params
period- window for the SMA and mean deviation. Default 20.
Output
Single column named after your indicator (e.g. cci).
Common thresholds
| Range | Meaning |
|---|---|
| > +100 | Strong momentum / overbought |
| < -100 | Strong momentum down / oversold |
| -100 to +100 | Normal range |
Some traders use ±200 as extreme thresholds for the strongest breakouts.
Usage
- Breakout entries when CCI crosses above +100.
- Mean reversion fades on CCI > +200 or < -200.
- Zero-line cross as a momentum direction flip.
Pitfalls
CCI is unbounded - extreme readings during news events can dwarf normal thresholds and stay extreme for many bars. Don't use CCI as the only filter for a high-volatility regime.
