SV

Street Verdict

Analyst Scorecard

All indicators
Momentum

CCI (Commodity Channel Index)

Is the price unusually far from its average?

How far today's typical price is from its 20-day average, measured in units of its usual distance from it.

CCI on a chart of past prices

Stock
Period
Loading RELIANCE daily prices…

Settings: move a slider and the chart redraws

20

How many days the average and the usual distance cover.

100

How far from zero counts as an unusual move for the rule.

What it measures

A day's typical price is (high + low + close) ÷ 3. CCI compares today's typical price with its 20-day average, and divides the gap by how far, on average, the last 20 typical prices have been from that average (the mean deviation).

A built-in constant, 0.015, scales it so most readings land between −100 and +100. Beyond ±100 the price is unusually far from its average. Despite the name, it is used on stocks as much as on commodities.

Traders read it two opposite ways: as a strong new move to go along with, or as a stretched price likely to snap back. This page tests the first reading.

How traders read it

  • Above +100: unusually far above its average, a strong move up. Below −100: unusually far below.
  • The trend reading, tested here: buy when CCI rises above +100, sell when it falls below −100. Marked on the chart.
  • The opposite, reversal reading treats below −100 as “oversold” and above +100 as “overbought”. Both are common; neither is right every time.

The traps

Two opposite readings

The same number can mean 'strong, join it' or 'stretched, bet against it'. Decide which one you are testing before you look at a chart.

No ceiling

CCI has no fixed limits: a quiet stock that suddenly moves can read +300.

Long holds

Buying above +100 and waiting for −100 can mean sitting through a long pullback before the rule sells.

Test the classic rule: CCI breakout

Would following the textbook signal have made money on this stock, after every cost, compared with just holding it? Run it and see.

Waiting for prices…

Quick check

Three questions on RELIANCE's own chart, with the classic settings. Get two right to mark CCI as done.

Waiting for prices…

Use it in a script

function run(bars, ta, helpers) {
  const cci = ta.cci(bars, 20);
  const up = helpers.crossover(cci, 100), down = helpers.crossunder(cci, -100);
  const signals = [];
  for (let i = 0; i < bars.length; i++) {
    if (up[i]) signals.push(helpers.buy(i));          // rises above +100
    else if (down[i]) signals.push(helpers.sell(i));  // falls below -100
  }
  return helpers.finalize(signals);
}

This is the rule tested above, with the settings on your sliders, and it gives exactly the same buy and sell candles. Paste it into the Scripts drawer of the chart workbench, or save it and compare it across stocks in the Strategy Lab. New to scripts? The Writing strategies track starts from zero.

In the reference:ta.ccihelpers.crossoverhelpers.crossunder