CCI indicator: formula, ±100 levels and how to backtest it on futures
The CCI measures how far the typical price sits from its moving average, scaled by 0.015 so that most readings fall inside ±100. The same ±100 crossing can be traded as a reversal or as a breakout; the two rules point in opposite directions and must be tested as separate candidates, with costs set before the first run.
By Soren Huang · Published · updated · Editorial policy
Contents
- How is the CCI indicator calculated?
- What CCI level counts as overbought or oversold?
- Reversal or breakout: which way should you trade the ±100 line?
- CCI settings: 14 or 20 periods?
- How does CCI differ from RSI and KD?
- How do CCI rules behave on different futures markets, and how do you read a backtest?
- Frequently asked questions
- References
How is the CCI indicator calculated?
The CCI indicator (Commodity Channel Index) measures how far the typical price of a bar sits from its own moving average, in units of the average distance over the lookback. A constant of 0.015 scales the result so that, by design, most readings fall between −100 and +100, and the readings beyond those lines are the zones that CCI rules trade.
Four quantities build the reading. Typical price is the average of a bar's high, low and close. The average is a simple moving average of the typical price over N bars, where N is the period you set (14 and 20 are the common choices). Mean deviation is the average of the absolute distances between each of the last N typical prices and that moving average, so it describes how far the typical price normally wanders. The CCI indicator page holds the full definition; the one formula worth remembering is:
CCI = (typical price − average) ÷ (0.015 × mean deviation)
Here typical price − average is today's distance from the average, mean deviation is the normal distance, and 0.015 is a fixed scaling constant. Dividing by the normal distance turns the reading into "how many normal distances away are we", and the constant stretches that number so that ordinary bars land inside ±100. The constant is not a setting to tune; the period is. Where CCI sits among the other oscillators and channel tools, and which of them can be written as fixed rules, is covered in the guide to technical analysis tools and indicators you can test.
Hypothetical example
Suppose today's typical price is 101, the 20-bar average of typical price is 100, and the mean deviation over those 20 bars is 0.5. The distance from the average is 1. The CCI is 1 ÷ (0.015 × 0.5) = 1 ÷ 0.0075 ≈ 133. The price is two normal distances above its average, and the reading sits above +100. If the mean deviation had been 1.0 instead, the same price would read about 67, inside the normal zone.
What CCI level counts as overbought or oversold?
By convention a reading above +100 is overbought and a reading below −100 is oversold, with ±200 marking an extreme, but these are zones the line visits often, not rare signals. The scaling is built so that most readings fall inside ±100, which means a meaningful minority fall outside. A strong trend can hold the reading above +100 for many bars in a row, and the price keeps rising while the indicator says "overbought" the whole time.
Three zones are enough for rule writing. Inside ±100 is the normal zone, where the price is near its average. Between ±100 and ±200 is the overbought or oversold zone, where the price is stretched. Beyond ±200 is the extreme zone, which the line reaches less often and usually during a fast move or a volatility shock. How much time the line spends in each zone depends on the market, the bar size and the period, so the useful habit is to count it on your own data: load your bars, pick your period, and count the share of bars outside ±100. That share tells you how often a reversal rule would be armed and how often a breakout rule would fire.
Two readings of the same level follow from this. A mean-reversion trader reads +100 as "stretched, likely to come back". A trend trader reads +100 as "strong enough to follow". Neither reading is wrong on its own; the next section shows that they produce opposite trades.
Reversal or breakout: which way should you trade the ±100 line?
The same ±100 crossing can be written as a reversal rule or as a breakout rule, the two rules trade in opposite directions at the same bar, and they must be tested as separate candidates. A reversal rule is a mean-reversion rule that waits for the line to come back out of the overbought or oversold zone and trades against the move. A breakout rule is a trend rule that enters when the line pushes into the zone and trades with the move.
| Rule part | Breakout (trend) rule | Reversal (mean-reversion) rule |
|---|---|---|
| Long entry | CCI crosses above +100 | CCI crosses back above −100 after being below it |
| Short entry | CCI crosses below −100 | CCI crosses back below +100 after being above it |
| Common exit | CCI crosses the zero line against the position | CCI reaches the zero line, or a fixed number of bars |
| Holding time | Longer; rides the trend | Shorter; takes the snap back |
| Market it suits | Trending stretches | Range-bound stretches |
| Typical failure | Whipsaws when the line hovers around ±100 | Fighting a trend that holds beyond ±100 |
Write each rule down with every condition fixed before you test it: which crossing enters, which crossing or level exits, and whether the rule trades both sides. "Trade the ±100 line" is not a rule; "go long on the close that crosses above +100, exit on the close that crosses below 0" is. Mixing the two directions in one candidate, for example entering on a breakout and adding a reversal filter later because the equity curve looked soft, turns a test into a fitting exercise.
The breakout version belongs to the same family as the Supertrend flip rule, which also enters after a move has already shown strength. The two differ in what they measure. Supertrend flips when the close crosses a band placed a multiple of the average true range away from price, so it reacts to price passing a volatility-sized distance. The CCI breakout fires when the distance from the average exceeds a multiple of the normal distance, so it reacts to the stretch itself. Supertrend is usually always in the market because each flip reverses the position; the CCI breakout has a separate exit and spends time flat. Testing both on the same bars tells you whether your market rewards "follow after a volatility-sized move" or "follow after a stretch from the average".
CCI settings: 14 or 20 periods?
Neither 14 nor 20 is the right CCI setting in itself; the right period is the one whose neighbouring values behave alike after costs. A shorter period makes the moving average and the mean deviation react faster, so the line crosses ±100 more often and earlier, which gives more trades and more noise. A longer period smooths both, so the line crosses less often and later, which gives fewer trades, later entries and fewer whipsaws.
| Effect | CCI(14) | CCI(20) |
|---|---|---|
| Crossings of ±100 | More | Fewer |
| Timing of the same crossing | Earlier | A few bars later |
| Trades per year | Higher | Lower |
| Cost drag | Higher, because more trades pay commission and slippage | Lower |
| Whipsaws around ±100 | More | Fewer |
| Missed start of a move | Smaller | Larger |
The way to choose is to test a range, not a pair. Run the rule with periods from about 10 to 30 in steps of 2, with the same commission, slippage and next-bar execution in every run, and put the average trade after costs on one line against the period. A good result is a plateau: a stretch of neighbouring periods, say 16 to 24, that all give a similar average trade. A bad result is a spike: 18 looks good, 16 and 20 look poor. Pardo (2008) describes this plateau test as the basic check of an optimized parameter, and the reasoning is simple. Live prices will not match your history, so a setting that only works at one exact value was describing noise in that history. Pick a period from the middle of the plateau, and record the plateau's width as part of the candidate's description.
The period also sets the trade count, and the trade count decides whether the result means anything. A 20-period reversal rule on daily bars may produce a handful of trades a year; the same rule on 15-minute bars produces many hundreds. Judge the sample in completed trades, not years, before you compare 14 with 20.
How does CCI differ from RSI and KD?
RSI and KD are bounded between 0 and 100, while CCI has no ceiling, so CCI keeps rising in a strong trend where RSI and KD flatten near their upper limit. The three also measure different things. RSI compares average gains with average losses over the period, as described by Wilder (1978). KD, the stochastic oscillator, places the close inside the high-to-low range of the period. CCI measures distance from an average in units of the normal distance. Because RSI and KD are ratios that cannot exceed 100, a trend that keeps making gains pushes them toward the ceiling, where they stop telling you how strong the move is. CCI has no ceiling, so a stronger stretch simply reads higher.
| Property | CCI | RSI | KD (Stochastic) |
|---|---|---|---|
| Scale | Unbounded | 0 to 100 | 0 to 100 |
| Input | Distance of typical price from its average | Average gain versus average loss | Close within the period's high-low range |
| Typical levels | ±100, extremes ±200 | 70 and 30 | 80 and 20 |
| Behaviour in a strong trend | Keeps rising | Flattens near the ceiling | Flattens near the ceiling |
| Natural rule type | Reversal or breakout | Mostly reversal | Mostly reversal, often with %K/%D crosses |
This difference changes what each indicator is good for. The ceiling makes RSI's 70/30 levels and the KD indicator's 80/20 levels natural reversal triggers, because a reading near the ceiling cannot go much further. The missing ceiling makes CCI usable as a trend measure too: a reading that climbs from +100 to +250 is new information, while RSI moving from 80 to 85 is barely a change. If you already trade an RSI reversal rule, the CCI reversal rule is a close cousin and will often fire on the same bars; the CCI breakout rule is the one that adds something RSI cannot express.
How do CCI rules behave on different futures markets, and how do you read a backtest?
A CCI rule's result depends more on the market's character than on the indicator, so test each market on its own and read the report by average trade after costs, trade count and drawdown rather than by net profit. Index futures such as ES and TAIEX futures spend long stretches trending, and those stretches reward the breakout use of ±100 while punishing a reversal rule that keeps selling into a rally. Range-bound stretches, which every market has, reward the reversal use and whipsaw the breakout rule. The share of each kind of stretch differs by market and by year, which is why one combined test over several markets hides what is happening in each.
- Write the entry and exit as fixed conditions. Which crossing enters, which crossing exits, long only or both sides.
- Set commission, slippage and next-bar execution before the first run. A rule that decides on the close must fill on the next bar; filling on the deciding close uses a price you could not have traded.
- Run the reversal and breakout versions as separate candidates, over a range of periods, on each market separately.
- Read average trade after costs, trade count and maximum drawdown. Net profit alone says nothing about how it was earned.
- Check neighbouring periods and the out-of-sample stretch before keeping any candidate.
The run below shows what such a report looks like in practice. It tested a Volume Profile Levels rule, a stand-in built from standard indicators rather than a CCI rule, on ES daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $25 slippage charged on every trade. It is the one candidate the search kept out of the 1,024 it tried, chosen for its return against its drawdown, and picking the best candidate after the fact flatters it: the kept one carries a selection bonus that a fresh stretch of data will not pay, a point Bailey et al. (2014) make in detail.
Source: AlphaPrime product engine (CPU), run 2026-10-31. ES daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $25 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $137,912.5 |
| Max drawdown | $37,892.5 |
| Trades | 160 |
| Win rate | 51.25% |
| Profit factor | 1.482 |
| Average trade | $861.95 |
| Time in market | 84.23% |

Read it in this order. First the average trade, $861.95, against the $45 of commission and slippage charged on each trade: the costs are a small share of the average trade, so a doubling of slippage would not change the sign. Second the trade count, 160 over about six and a half years, which is enough to make the average meaningful but few enough that a handful of large trades could move it; the trade list tells you how concentrated the result is. Third the maximum drawdown, $37,892.5, against the net profit of $137,912.5: the worst losing stretch took back a little over a quarter of what the whole period earned, and that drawdown, not the net profit, is the number to hold against your account size. Fourth the time in market, 84.23%, which says this rule holds positions most of the time and so carries overnight exposure in almost every week. In AlphaPrime (Valynox) these figures sit together with the trade list and the periodic breakdown in the Performance Report, so the same four numbers can be read for a CCI candidate the moment its run finishes. None of this is a forecast, and a CCI rule tested the same way will show its own numbers.
Hypothetical example
Suppose a CCI(20) breakout rule on an index future shows 400 trades with a gross average trade of $70 before costs. With $45 of commission and slippage per trade, the average trade after costs is $25, a little over half the gross. Doubling the slippage to $50 would bring the cost to $70 and the average trade to zero. The result is positive but thin, so the plateau check and the out-of-sample stretch decide whether to keep it, not the headline profit.
Your next step: take your own bars for one market, write the CCI(20) breakout rule and the CCI(20) reversal rule as two fixed candidates, run each with your real commission, one tick of slippage per side and next-bar execution, and count how many trades each produced. If either has fewer than a few hundred, move to a smaller bar size or a longer history before comparing the two.
Frequently asked questions
Can the CCI go above 200 or below −200?
Yes. The CCI has no upper or lower limit, because it divides the distance from the average by the normal distance and nothing caps the result. Readings beyond ±200 are less common than readings between ±100 and ±200 and usually appear during fast moves or volatility shocks. How often they occur depends on the market, the bar size and the period, so count them on your own data rather than assuming a share.
Is the CCI a leading or a lagging indicator?
It is built from a moving average and a moving mean deviation, so it lags price like any averaged indicator; a shorter period lags less and a longer period lags more. The "leading" impression comes from the reversal use, where a reading leaving the ±100 zone is read as a sign the move is tiring. That is an interpretation of the lagging reading, not a forecast, and it must be tested as a fixed rule like any other.
What time frame works best for CCI?
CCI is calculated the same way on every bar size, so the choice sets the trade count and the holding time rather than the indicator's meaning. Daily bars give a handful of trades a year for a 20-period rule; intraday bars give hundreds. Pick the bar size that gives enough completed trades to judge, run the same rule with the same costs on it, and check that neighbouring periods behave alike before trusting the result.
Does a CCI strategy work on futures?
A CCI rule is a fixed condition on price, so it can be tested on any futures contract with bar data, and whether it holds up is a result to measure, not a property of the indicator. The breakout use tends to suit the trending stretches of index futures and the reversal use tends to suit range-bound stretches, but the mix changes by market and by year. Test each market separately, with commission, slippage and next-bar execution set first, and read the average trade after costs, the trade count and the drawdown.
References
- Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research.
- Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.

