CCI — Commodity Channel Index
CCI (Commodity Channel Index) measures how far price has deviated from its statistical average over a lookback period. Despite the name, it works on every asset class, not just commodities. Readings above +100 = strong upward momentum (or overbought). Below −100 = strong downward momentum (or oversold). Developed by Donald Lambert in 1980.
The formula
Typical Price = (High + Low + Close) / 3
Mean Deviation = average absolute deviation of Typical Price from its SMA over N periods
CCI = (Typical Price − SMA of Typical Price) / (0.015 × Mean Deviation)
The 0.015 constant is arbitrary — Lambert chose it so most readings fall between +100 and −100. That gives the ±100 rule its meaning.
Default period: 20. The indicator is unbounded (can go well above +200 or below −200 in volatile moves), but most price action stays within ±100.
How CCI is interpreted
The ±100 rule.
- CCI above +100 → price is meaningfully above its average; trend is strong bullish
- CCI below −100 → price is meaningfully below its average; trend is strong bearish
- Between −100 and +100 → normal range; mean reversion possible
Two schools of thought:
Reversal interpretation. Treat ±100 as overbought/oversold. Fade extremes. Works in ranging markets.
Continuation interpretation. Treat crosses beyond +100 or −100 as breakout signals — trend is strong, jump in. Works in trending markets.
You can't use both interpretations without a regime filter. Know which environment you're in before trading CCI.
Divergence. CCI divergence against price is one of its strongest signals — especially when combined with a reversal zone. Price makes a new high while CCI prints a lower high = bearish divergence.
CCI vs RSI
| Feature | CCI | RSI |
|---|---|---|
| Bounded | No (unbounded) | Yes (0–100) |
| Scale | Centered on zero | 0–100, midline 50 |
| Input | Typical Price | Close |
| Smoothness | Moderate | Smoother |
| Primary use | Trend + reversal | Momentum + divergence |
CCI's unbounded nature is what makes it useful for breakout traders — extreme readings (±200+) signal exceptional momentum.
CCI in Pine Script (v6)
//@version=6
indicator("CCI + Alerts", overlay=false)
length = input.int(20, "CCI Length")
obLevel = input.float(100, "Overbought/Breakout +")
osLevel = input.float(-100, "Oversold/Breakdown −")
cciVal = ta.cci(close, length)
plot(cciVal, color=color.orange, linewidth=2, title="CCI")
hline(obLevel, "+" + str.tostring(obLevel), color=color.red)
hline(0, "Zero", color=color.gray)
hline(osLevel, str.tostring(osLevel), color=color.green)
if ta.crossover(cciVal, osLevel)
alert("CCI exited oversold (crossed above -100)", alert.freq_once_per_bar_close)
if ta.crossunder(cciVal, obLevel)
alert("CCI exited overbought (crossed below +100)", alert.freq_once_per_bar_close)
if ta.crossover(cciVal, obLevel)
alert("CCI bullish breakout (crossed above +100)", alert.freq_once_per_bar_close)
if ta.crossunder(cciVal, osLevel)
alert("CCI bearish breakdown (crossed below -100)", alert.freq_once_per_bar_close)
Common mistakes
- Picking one interpretation and using it everywhere. Reversal interpretation fails in trends; continuation interpretation fails in chop. Use ADX or another trend filter to pick which rule applies.
- Treating zero-line crossings as signals. They generate too many signals to be useful alone.
- Ignoring divergence. It's the single highest-conviction CCI signal when paired with an extreme reading. Don't ignore it.
Frequently Asked Questions
What is a good CCI setting?
The default 20-period is the standard. Shorter periods (9, 14) react faster but generate more noise. Longer periods (34) smooth out whipsaws. 20 balances speed and reliability for most timeframes.
Is CCI only for commodities?
No — despite the name, CCI works on any instrument. Lambert developed it for commodities, but the math is asset-agnostic. Modern traders use it on stocks, futures, forex, and crypto interchangeably.
How do I avoid CCI whipsaws?
Two common approaches: (1) require a close above/below the ±100 threshold rather than an intra-bar touch, and (2) add a regime filter like ADX > 20 for breakout interpretation or ADX < 20 for reversal interpretation. Without either, CCI signals whipsaw in chop.