CCI Calculator (Commodity Channel Index)
Calculate Commodity Channel Index from typical price, SMA, and mean deviation.
Reads ±100 for normal range; ±200 for extreme overbought/oversold.
Donald Lambert published CCI in 1980 for commodity traders. It works on stocks and forex too — the name is historical. The formula:
CCI = (Typical Price - SMA of TP) / (0.015 × Mean Deviation)
- Typical Price = (High + Low + Close) / 3
- SMA = N-period simple moving average of TP, default 20
- Mean Deviation = average of |TP - SMA| over the same N periods
- 0.015 is a constant Lambert chose so that ~70-80% of values fall between -100 and +100
The 0.015 constant is the key. Lambert wanted “normal” market action to live inside ±100, with strong trends pushing past ±100, and extremes hitting ±200. He picked 0.015 to make that happen for commodities of the era. The constant is built into every CCI plot since.
Reading the value.
- Above +100: strong upward momentum
- Above +200: extreme overbought
- Between -100 and +100: trading range
- Below -100: strong downward momentum
- Below -200: extreme oversold
Lambert’s original rules. Go long on a cross above +100, exit on cross back below +100. Reverse for shorts. The system catches strong trending moves but eats whipsaws in chop. Most modern traders use CCI for divergences and as a second confirmation rather than as a standalone trigger.
Mean deviation, not standard deviation. This is what makes CCI different from a normalized z-score. Mean deviation is the simple average of absolute distances from the mean. It is less sensitive to outlier bars than σ would be. Stocks have rare massive bars; mean deviation keeps them from blowing up the indicator’s scale.
Why CCI on commodities first. Commodities have cyclical seasonality — corn, wheat, oil all move in repeating annual cycles. Lambert wanted an indicator that measured deviation from a mean expected by the cycle. The cycle assumption matters less now (CCI is used everywhere), but the math survived.
Worked example. Today’s H/L/C = 102.40 / 100.10 / 101.30. Typical Price = 101.27. 20-period SMA of TP = 99.85. Mean Deviation = 1.20.
- CCI = (101.27 - 99.85) / (0.015 × 1.20)
- CCI = 1.42 / 0.018 = 78.9
Solidly positive but inside the ±100 normal range. A close that pushes CCI above 100 would be the trend trigger.