← Back to Home
Trading Signal / Indicator
🔭

Commodity Channel Index (CCI)

Identify cyclical turns and overbought/oversold extremes.

Start Automating Free →

Want to automate this strategy? Try auto-Trading free — no credit card required.

Commodity Channel Index (CCI) chart

Overview

What is Commodity Channel Index (CCI)?

The Commodity Channel Index (CCI) was developed by Donald Lambert and published in 1980. Despite its name, it is widely used across all asset classes. The indicator measures how far the current typical price has deviated from its recent average, scaled by the mean absolute deviation to normalise the result.

CCI = (Typical Price − N-period SMA of Typical Price) ÷ (0.015 × Mean Absolute Deviation)

The constant 0.015 was chosen so that approximately 70–80% of CCI values fall within the ±100 range under normal conditions. Values above +100 indicate the price is significantly above its recent average (overbought in ranging markets; a strong momentum signal in trending markets). Values below −100 indicate the price is significantly below its average (oversold or strong bearish momentum).

Trading applications include: counter-trend entries when CCI exceeds ±100 in ranging markets, trend-following entries after CCI rises above +100 (buy) or falls below −100 (sell) in trending markets, and divergence between CCI and price as a reversal signal.

When used on higher timeframes (weekly or monthly), CCI is particularly effective at identifying major cyclical turning points in commodities and equities.

How It Works in auto-Trading

Automate It

auto-Trading computes CCI using the typical price ((high + low + close) ÷ 3) over the configured period (default 20). The strategy builder supports CCI level crossovers, zone entries, and divergence detection. CCI can be applied to any timeframe and combined with trend filters to distinguish between trending and ranging regimes.

Try Free →

Strategy Code

Pick a script below, copy it, and use it on your chart.

Pine Script (TradingView)

This is a TradingView Pine Script example for this indicator. Paste it into the TradingView Pine Editor, add it to your chart, and adjust inputs for your market and timeframe.

//@version=6
strategy("Commodity Channel Index (CCI)", overlay=true)
fastLen = input.int(20, "Fast Length")
slowLen = input.int(50, "Slow Length")
fast = ta.ema(close, fastLen)

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

ThinkScript (thinkorswim)

This is a thinkorswim ThinkScript example for this indicator. Open thinkorswim, create a custom study, paste the script, and apply it to your chart.

input length = 20;
def cci = CCI(length = length);
def buySignal = cci crosses above -100;
def sellSignal = cci crosses below 100;
AddOrder(OrderType.BUY_AUTO, buySignal, close, 1, Color.GREEN, Color.GREEN, "CCI Buy");

Get full strategy code access

Enter your email address and full name to unlock this strategy code.

Ready to automate Commodity Channel Index (CCI)?

Join thousands of traders who use auto-Trading to execute this strategy automatically, 24/7.

Get Started Free →

All Strategies & Signals

Continue Learning

Trading Strategies

Trading Signals & Indicators