Commodity Channel Index (CCI)
The CCI measures how far the current price deviates from its statistical average. Despite the name, it works on any asset — not just commodities. It is effective for identifying overbought/oversold conditions, trend changes, and divergences.
How it works: CCI calculates the difference between the current typical price (HLC/3) and its simple moving average, then divides by the mean deviation. The result is an unbounded oscillator centered on zero.
Resources: TradingView CCI docs
Settings in block algo flex
| Setting | Description | Default |
|---|---|---|
| Use CCI? | Enable/disable the indicator | Off |
| InpCCI_length | Number of periods for calculation | 20 |
| Source | Price data source (hlc3 = average of High, Low, Close) | hlc3 |
| Timeframe | Timeframe for calculation | Chart |
| Buy Condition | Condition for buy signal (e.g., "Crossing -100") | Crossing -100 |
| Sell Condition | Condition for sell signal (e.g., "Crossing 100") | Crossing 100 |
How to Interpret
- CCI > +100 — Price is significantly above its average; potentially overbought or in a strong uptrend
- CCI < -100 — Price is significantly below its average; potentially oversold or in a strong downtrend
- Crossing above -100 — Momentum shifting from bearish to neutral/bullish
- Crossing below +100 — Momentum shifting from bullish to neutral/bearish
Pro Tip: Unlike bounded oscillators (RSI, Stochastic), CCI has no fixed upper or lower limit. Values can reach +300 or -300 in extreme moves. Use the crossing conditions rather than fixed thresholds for more reliable signals.