How it works
CCI is a standardised distance measure. It takes the typical price of the bar, subtracts a moving average of typical price, and divides by how far typical price usually strays from that average. The result is a statement in statistical units: a CCI of +200 means the market is about two of its usual deviations above its recent mean, whatever that mean happens to be. This makes it structurally similar to a z-score, and it is the reason CCI readings can be compared across instruments and across timeframes in a way that raw momentum cannot.
The one detail that surprises people is the constant 0.015 in the denominator. It exists purely as a scaling choice: its author picked it so that under typical conditions roughly three-quarters of readings would land between -100 and +100, which makes those two lines the natural boundaries of 'normal'. The deviation measure is mean absolute deviation, not standard deviation, which makes CCI less sensitive to a single violent bar than a true z-score would be.
The name is another historical artefact. It was designed with commodity cycles in mind, but there is nothing in the arithmetic specific to commodities and it is applied to equities, futures and crypto without modification. What was specific to the original conception is the idea of measuring cyclical turns: the author's intent was to identify the beginning and end of a cycle, with the recommendation to trade only the portion where the reading was beyond the boundaries.
Two schools of use exist and they contradict each other, which is worth stating plainly. The reversion school treats readings beyond ±100 as stretched and fades them back toward zero. The breakout school treats a move beyond +100 as confirmation that a trend has begun and buys it. Both work in the right regime and both fail badly in the wrong one, so the meaningful decision is not which threshold to use but which regime you believe you are in. A trend filter over the top of CCI resolves most of the contradiction.
Against its neighbours: unlike RSI and the Stochastic, CCI is unbounded, so it can register genuinely exceptional dislocations with a reading of ±400 rather than saturating at 100. That makes it better at distinguishing 'stretched' from 'extraordinary', and worse at providing a fixed scale you can memorise.
Calculation
The arithmetic in words, in the order it happens.
For each bar compute the typical price, (high + low + close) / 3. Take a simple moving average of typical price over N bars, conventionally 20. Compute the mean absolute deviation over the same window: the average of the absolute differences between each of the last N typical prices and that same moving average value. Then CCI = (typical price - moving average of typical price) / (0.015 x mean absolute deviation). Note it is mean absolute deviation, not standard deviation, and the 0.015 constant exists only to scale the result so that roughly 70-80 percent of readings fall inside the -100 to +100 band.
Source
An AlgoBeamScript implementation of the formula above, written by us from the arithmetic so the code and the calculation agree line for line.
Runs unchanged on the platform and in the AlgoBeamTS runtime. The language reference is in the documentation.
Inputs
Defaults are the values most charting packages ship with. They are conventions, not optimal settings — the right length depends on your instrument and your holding period.
| Input | Default | What it changes |
|---|---|---|
| Length | 20 | Bars in both the moving average and the deviation window. Shorter settings such as 14 exceed ±100 far more often and suit short cycles; 40 or more produces an indicator that only leaves the band on genuinely unusual moves. |
| Source | HLC/3 (typical price) | The price definition being standardised. Typical price is the classic choice because it includes the whole bar's territory; switching to close makes the indicator jumpier around bars with long wicks. |
| Overbought / oversold levels | +100 / -100 | The conventional boundaries implied by the 0.015 constant. Traders working with volatile instruments often widen them to ±200 so the lines still mark unusual behaviour rather than routine movement. |
How to read it
What practitioners take from the plot. Read these as descriptions of market state, not as entry signals.
- Crossing above +100
- Price has moved beyond its normal distance above the mean. Read as the start of an upside expansion by breakout traders and as a stretched condition by reversion traders — the regime decides which is correct.
- Crossing below -100
- The mirror case on the downside: an unusually large negative excursion from the recent mean.
- Returning inside ±100 after an extreme
- The dislocation is closing. This is the reversion trader's actual trigger, and it avoids the trap of fading a move that is still expanding.
- Oscillating tightly around zero
- Price is sitting close to its own average with no unusual excursions — a balanced, low-information regime where CCI-based rules should be stood down.
- Extreme readings beyond ±300
- A genuinely rare dislocation, usually news-driven. Because CCI is unbounded these readings are informative, unlike a saturated RSI at 100.
Limitations
Where this indicator misleads. None of these are fixed by a better parameter.
- It is unbounded, so there is no ceiling to lean on. A rule that fades ±100 has no defence against a market that runs to ±400 while the position is open.
- The two standard interpretations conflict. Without an explicit regime filter, the same CCI cross is a buy signal to one school and a sell signal to the other, and backtests inherit whichever bias the sample period had.
- It uses a simple moving average and a fixed window, so it lags and it drops old bars abruptly; a large bar leaving the window shifts the reading even when nothing has happened today.
- In compressed, low-volatility conditions the mean absolute deviation shrinks and the denominator becomes tiny, which inflates the reading and produces spurious extremes on trivially small price moves.
Educational reference. This page explains how an indicator is built and how it is commonly read. It is not investment advice, not a recommendation and not a signal service. No indicator is profitable on its own — each is a way of describing a market, and any rule built on one has to be tested with realistic costs before it is traded.