What Is the CCI Indicator? Formula, a Worked Example on SPY, and What ±100 Means
CCI, the commodity channel index, measures how far the typical price is from its own moving average, divided by the average deviation over the same window. The ±100 lines are a convention rather than a limit; the formula's real ceiling, 666.67 at the default length of 20, sits far beyond them.
Covered on this page: TradingView.
The CCI, or commodity channel index, tells you how far price is from its recent average, measured in units of how far it normally strays. A reading of +100 means the typical price is above its 20-bar average by 100 of those units, and -200 means twice that distance below it.
Donald Lambert introduced it in Commodities magazine in 1980, which explains the name; the arithmetic has nothing in it that is specific to commodities. Below is the whole calculation done by hand on real SPY bars, then 33 years of data on the question every guide answers differently: what a move past ±100 means.
How it works
Four numbers, computed in order.
- Typical price for each bar: (high + low + close) / 3.
- The average of the last 20 typical prices.
- The mean deviation: how far each of those 20 typical prices sits from that average, ignoring the sign, averaged.
- CCI = (today’s typical price − the average) / (0.015 × the mean deviation).
The 0.015 only sets the scale. StockCharts’ ChartSchool says Lambert chose it so that roughly 70 to 80% of readings would land between -100 and +100. It changes how big the numbers look and nothing about when they rise or fall.
The length is the only setting. Twenty bars is the common default, and it sets both the average and the deviation window. A daily CCI(20) looks back about four weeks.
A worked example: SPY on 30 October 2026
The 20 sessions from 5 to 30 October 2026, from Yahoo’s daily bars:
| Date | High | Low | Close | Typical price | Distance from average |
|---|---|---|---|---|---|
| 5 Oct | $776.61 | $769.63 | $774.83 | $773.69 | $3.36 |
| 6 Oct | $781.62 | $777.96 | $779.09 | $779.56 | $9.23 |
| 7 Oct | $779.10 | $773.61 | $777.22 | $776.64 | $6.32 |
| 8 Oct | $777.09 | $770.44 | $773.93 | $773.82 | $3.49 |
| 9 Oct | $779.42 | $775.14 | $778.57 | $777.71 | $7.38 |
| 12 Oct | $779.40 | $777.05 | $778.10 | $778.18 | $7.86 |
| 13 Oct | $778.75 | $775.95 | $778.01 | $777.57 | $7.24 |
| 14 Oct | $776.35 | $766.71 | $769.60 | $770.89 | $0.56 |
| 15 Oct | $772.87 | $764.43 | $771.79 | $769.70 | $0.63 |
| 16 Oct | $773.25 | $760.64 | $763.25 | $765.71 | $4.61 |
| 19 Oct | $770.46 | $765.82 | $766.48 | $767.59 | $2.74 |
| 20 Oct | $772.29 | $764.25 | $769.05 | $768.53 | $1.80 |
| 21 Oct | $774.44 | $768.40 | $773.09 | $771.98 | $1.65 |
| 22 Oct | $767.71 | $761.17 | $763.96 | $764.28 | $6.05 |
| 23 Oct | $763.47 | $758.68 | $759.97 | $760.71 | $9.62 |
| 26 Oct | $767.73 | $761.63 | $765.37 | $764.91 | $5.42 |
| 27 Oct | $771.14 | $765.21 | $769.66 | $768.67 | $1.66 |
| 28 Oct | $773.36 | $769.24 | $772.31 | $771.64 | $1.31 |
| 29 Oct | $770.76 | $766.62 | $769.36 | $768.91 | $1.41 |
| 30 Oct | $761.46 | $750.36 | $755.72 | $755.85 | $14.48 |
Step 1, typical price on 30 October: ($761.46 + $750.36 + $755.72) / 3 = $755.85.
Step 2, the 20-day average of the typical-price column: $770.33.
Step 3, the mean deviation: the average of the last column, $4.84. On a normal day in this window, the typical price sat a little under $5 from its average.
Step 4, CCI: ($755.85 − $770.33) / (0.015 × $4.84) = -$14.48 / $0.0726 = -199.40.
What the number says: Friday’s sell-off put SPY’s typical price three times its usual distance under the average, well past the -100 line. It says nothing about Monday. The calculation uses unrounded prices, so redoing it with the rounded figures above can move the last decimal.
What +100 and -100 are supposed to mean
The three guides Google ranked highest for “cci indicator” on 1 November 2026 do not agree, and two of them point opposite ways.
- As a new trend. StockCharts says a surge above +100 can signal the start of an uptrend and a plunge below -100 the start of a downtrend, and Fidelity lists the cross above +100 as a buy signal.
- As a stretch to fade. Investopedia treats a reading above 100 that starts to curve down as a possible sell, and one below -100 that curves up as a possible buy.
Both can be tested on the same bars, so we did. On SPY’s daily chart since 1993 there were 565 crosses up through +100 and 393 first curl-downs while still above it. The table under The original data shows what followed. In short: SPY’s next 20 sessions after either event looked like any other 20 sessions.
That fits the arithmetic. CCI is a scaled distance from a moving average. Being far above the average says the last few weeks were strong; it does not say whether the next few will be. The mean reversion idea and the trend idea are both stories about that distance, and on this test neither showed up.
How often CCI sits inside ±100
About half the time, not three quarters. CCI(20) was inside ±100 on 4,644 of SPY’s 8,478 daily readings, 54.78%. It was above +100 on 2,523 and below -100 on 1,311, nearly twice as often above, in a fund that mostly rose.
No calendar year from 1994 to 2025 reached 70%. The range ran from 47.62% in 1995 to 67.46% in 2015.
Length works the other way from the usual description. ChartSchool says a 10-period CCI has a smaller share of values inside ±100 and a 40-period one a larger share. On SPY it was the reverse: 58.33% at 10, 56.93% at 14, 54.78% at 20, 52.15% at 40. QQQ since 1999 ran the same direction: 56.75%, 55.16%, 53.94% and 51.55%. One possible reason is the ceiling below: a short window cannot stretch as far, so fewer readings make it past 100.
Readings past the line come in short runs. A run above +100 lasted a median 4 sessions on SPY, the longest 20; 71 of the 565 runs reached +200 before they ended.
Is the CCI unbounded?
Guides often say so, and it is not quite true. Today’s bar is one of the bars in its own average, which caps how far it can sit from that average: at most half the length times the mean deviation. Divide by 0.015 and CCI(20) can never pass ±666.67. At length 10 the cap is ±333.33, at 14 it is ±466.67, at 40 it is ±1,333.33.
A real market has hit the cap. TLT, the long Treasury bond fund, printed a CCI(10) of exactly -333.33 on 9 November 2016, the day after the election, which happens when every other bar in the window sits on the far side of the average.
At length 20 the cap is far away. SPY’s lowest CCI(20) since 1993 was -424.10, on 24 August 2015, and its highest +310.25, on 5 September 1995. That is still the practical difference from RSI and the stochastic, which stop at 0 and 100.
CCI divergence, and a real one from August 2026
A divergence is price and CCI disagreeing at an extreme. Price closes at a new high while CCI’s peak is lower than its last one (bearish), or the mirror at a low (bullish). The RSI divergence and MACD divergence pages cover the same idea.
A real one: on 13 August 2026 SPY closed at $777.88, its highest close in 40 sessions, with CCI(20) at 106.91. On 4 August, at a lower close of $771.33, CCI had read 242.10. Twenty sessions later, on 11 September, SPY closed at $764.29, after a low close of $757.83 the day before. Then on 6 October it closed at a new high of $779.09 with CCI at 189.54: the divergence was followed first by a dip and then by a higher high.
Counted on 33 years of SPY, it did not stand out. Our definition: a close above every close of the previous 39 sessions, with CCI(20) below its own highest reading of those 39 sessions; an event counts only if it comes 20 or more sessions after the last one counted, so the follow-up windows do not overlap. That found 205 bearish divergences. SPY was higher 20 sessions later after 135 of them, 65.85% (median +1.30%), against 62.62% (median +1.06%) after the 107 new highs that CCI confirmed and 65.33% for any session. The mirror for lows found 83 bullish divergences, higher after 65.06%, against 66.10% for the 59 lows CCI confirmed. On QQQ, bearish divergences were followed by a higher close more often than confirmed highs, 69.33% against 58.33%, the opposite of the textbook reading. None of these gaps passes a standard two-proportion test at the 5% level, so all are within what chance produces on samples this size; each event is in the CCI divergence file.
The original data
The test. Yahoo Finance daily bars for SPY (29 January 1993 to 30 October 2026) and QQQ (10 March 1999 to 30 October 2026). CCI uses the unadjusted high, low and close, as a chart draws them, with the mean deviation taken around the same window’s average; “inside” means strictly between -100 and +100. Returns use the dividend-adjusted close 20 sessions after the event. A cross up is a reading above +100 after one at or below it; a curl-down is the first session in a run above +100 where CCI falls from the session before (QQQ’s first run, already under way when its CCI data begins, is left out).
What followed each reading, next 20 sessions:
| Event, CCI(20) | SPY events | Median move | Higher after 20 | QQQ events | Median move | Higher after 20 |
|---|---|---|---|---|---|---|
| Any session (the base rate) | 8,458 | +1.41% | 65.33% | 6,916 | +1.63% | 62.62% |
| Crossed above +100 | 565 | +1.55% | 66.61% | 405 | +2.11% | 67.16% |
| First curl-down above +100 | 393 | +1.23% | 64.71% | 295 | +1.34% | 62.37% |
| Crossed below -100 | 348 | +1.79% | 68.21% | 300 | +2.07% | 62.96% |
| First curl-up below -100 | 223 | +1.61% | 65.92% | 194 | +2.75% | 65.10% |
Every row sits close to the base rate. The share higher after 20 sessions is within five percentage points of it in every row; the widest gap, QQQ after a cross above +100, is 4.54 points.
The events overlap (a 20-session window after one cross often contains the next), and a fund that rose most years makes “higher” common for everything, so the fair reading is narrow: neither a trend reading nor a fade reading of ±100 moved far from an ordinary day on these two funds. Every event and its outcome is in the CCI crossings file.
The length figures for both funds are in the CCI inside ±100 by length file. The counts behind the bars: on SPY, 4,951 of 8,488 readings at length 10, 4,830 of 8,484 at 14, 4,644 of 8,478 at 20 and 4,411 of 8,458 at 40; on QQQ, 3,942 of 6,946, 3,829 of 6,942, 3,741 of 6,936 and 3,565 of 6,916. As a check, CCI(20) computed from Nasdaq’s SPY history, 2,495 readings from 28 November 2016, landed on the same side of ±100 as the Yahoo version on 2,491 of them, the largest gap was 25.87 points, and 174 of Yahoo’s 175 crosses above +100 in that period fell on the same date in the Nasdaq data.
When it fails
A strong trend keeps it pinned past the line
On SPY, 337 daily CCI(20) readings went beyond ±200. Selling the first reading over 100 in a steady advance, then the next, then the one after, is the classic way this indicator loses money: the reading looks stretched every day of a good trend.
The ±100 lines carry more weight than they earn
The 0.015 constant was meant to put most readings inside ±100, and on SPY it put a little over half there. A market does not change character at 100. A rule built on the line inherits an arbitrary choice made in 1980.
It is the same measurement as a band you may already have
If Bollinger Bands are on the chart, CCI is the same question in a panel: how far is price from its 20-bar average in units of its usual spread. Agreement between the two is one measurement seen twice, a common way technical analysis ends up counting the same evidence as two votes.
It has no price in it
CCI can tell you price is far from average; it cannot tell you where you are wrong. The 30 October reading of -199.40 came with no level to invalidate it. That has to come from the price chart, a trading range edge or a swing low.
Questions people ask
What does the CCI indicator tell you?
How far the typical price is from its average over the chosen window, in units of its usual distance. On 30 October 2026 SPY’s CCI(20) was -199.40: about three times its usual distance below the 20-day average.
What is the best setting for CCI?
There is no best one, and 20 is the common default. Length changes how often readings cross ±100: on SPY, 10 sat inside on 58.33% of days and 40 on 52.15%. Pick the window that matches how long you hold.
Which is better, RSI or CCI?
They answer different questions. RSI compares the size of recent up moves with down moves and stops at 0 and 100; CCI measures distance from an average and runs to ±666.67 at length 20. The RSI vs CCI comparison goes through both.
Is CCI a leading or lagging indicator?
Lagging, like anything built on a moving average. It describes the last 20 bars; on SPY its ±100 crossings were followed by ordinary 20-session returns.
Related
Bollinger Bands draw the same measurement on the price chart, and comparing the two is the quickest way to understand either.
The moving average is the thing CCI measures distance from.
How to use the CCI turns this into steps, and RSI is the bounded alternative worth reading alongside it.
This asks the same question as a Bollinger band, just answering it with a number instead of a line. Both measure how far price is from its average in units of how far it usually goes. Running both means hearing the same thing twice and counting it as agreement.
— Michael Whitman
This page is educational, not financial advice. Test every idea on your own charts before risking money. Some links on this page earn a commission if you buy through them. It costs you nothing and it does not decide what appears here or in what order — how these pages are made is set out in our methodology.