CCI Indicator — What is it? (Trading Strategy And Backtest)
Last Updated on October 22, 2022
Technical indicators help traders in timing the market, and the CCI is one of the indicators you can effectively use to time the momentum in the market. But what exactly is the CCI, and what does it tell you about the market?
The CCI (Commodity Channel Index) is a technical indicator that measures the current price level of a security relative to an average price level over a given period. It is a momentum oscillator that is used to identify extreme conditions, such as oversold and overbought conditions, in the market. Its readings are relatively high when prices are far above their average and relatively low when prices are far below their average.
We start the article by explaining the theory behind the indicator, and we end the article by doing some backtesting CCI indicator.
What is CCI?
The commodity channel index (CCI) is a technical trading indicator that measures the current price level of a security relative to an average price level over a given period. It is a momentum oscillator that is used to identify extreme conditions in the market. Its readings are relatively high when prices are far above their average and relatively low when prices are far below their average. Extreme values may indicate overbought/oversold conditions in the market.
Originally, the CCI was used to trade commodities, but over the years it has been adopted to trade every kind of financial security including stocks and ETFs. The commodity channel index forecasts when a market cyclical reversal is likely. One of the fundamental theories of the CCI is that market moves in cycles, with peaks and troughs coming at time intervals.
One of the fundamental theories of the CCI is that market moves in cycles, with peaks and troughs coming at time intervals.
The CCI oscillates above and below the zero point. Below is a chart that shows how a 10-day CCI oscillates up and down:
When the commodity channel index moves from a positive or near-zero region to below -100 that may be telling you that a new downtrend is underway. When that happens, you can wait for a retracement in price followed by a downward movement of both price and the CCI to signal a selling opportunity (according to the original theory behind the indicator). The same method applies to a new uptrend. When the indicator goes from a negative or near-zero region that may indicate the emergence of a new rally. At this point, you may want to get out of any short position and look for buying opportunities.
Generally, CCI is said to be overbought when it moves above +100 and oversold when it moves below -100. However, the CCI reading of oversold/overbought levels in the market is unbound. This is so because different security behaves differently from one another. As a trader, you have to look at a security’s historical reading on the CCI to get a glimpse of where the price reversed. For instance, the SPX (S&P 500) may tend to reverse at the +150/-180 region whereas the NDX (Nasdaq 100) may tend to reverse at the +200/-130 region. You may want to zoom out on your chart to see reversal points and the reading of the CCI at those points.
Besides oversold/overbought levels in the market, the CCI sometimes shows divergence with price. This is when the indicator is moving in the opposite direction to the price. When the indicator is rising and the price is falling, it may indicate the weakening of the downtrend. But if the indicator is falling with rising price, the uptrend is losing momentum and a reversal may be likely. Divergence may not be an accurate reversal signal but it should still be considered a warning sign that market conditions may change. Therefore, traders should adjust risk accordingly.
What is the formula of the CCI?
The calculation of the CCI is done automatically by your trading software, for example, Amibroker. To calculate by hand, would require several steps.
The steps are listed below in sequential order.
First, you must calculate the typical price, which is the mean value of the high, low, and close.
The formula is:
High = the highest price for the set period.
Low = the lowest price for the set period.
Close = the closing price for the set period.
Compute the simple moving average of the above for a given number of periods used.
TPma = moving average of the typical price
TP = the typical price for a given nth period
n = the number of periods for the average
Compute the mean deviation. The formula is as follows:
TPn = typical price for the nth period.
TPma,n = the simple moving average of the typical price for the nth period.
n = number of periods.
Finally, the commodity channel index is computed as follows:
CCI = the commodity channel index for the current time.
TPt = the typical price for the current time.
TPma,t = the simple moving average of the typical price.
.015 = constant.
MDT = the mean deviation of the current time.
Who invented the CCI indicator?
The commodity channel index was created by Donald R. Lambert in 1980 to spot reversals in commodities, but the indicator is now widely used in other securities including stocks and ETFs.
What is the history of CCI, and when was it invented?
Donald Robert published the commodity channel index in the Commodities magazine (now Futures) in 1980. Originally, the CCI was used to trade only commodities, but now, it is used to trade in any market. The indicator has been in use for more than three decades now and has become more popular with the emergence of automated trading systems.
Limitations of the CCI
The CCI is dependent on price and this makes it a lagging indicator. Also, the indicator is not a timing tool as it does not indicate at what particular point in the market you should be entering. The market can be at an overbought/oversold level for a prolonged period of time, which might make you miss out on the current move since you will be waiting for a reversal that may or may not happen. If you want to use this indicator, backtest your strategy and optimize it for robustness before putting your money on the line.
CCI trading strategies (backtests)
Let’s go on to backtest some trading strategies for the CCI. We have never had any experience with the CCI indicator before and thus this is the first time we backtest the indicator.
When we try something new we like to use strategy optimization. This way, we get a better “feel” for how the indicator performs. As usual, we backtest the CCI indicator on S&P 500 by using the ETF with the ticker code SPY. The CCI might work better on other assets.
CCI trading strategy no. 1
The first trading strategy is described like this in plain English:
- We use an N-day lookback period (2 to 10 days).
- We go long when the CCI crosses below the CCI buy threshold (-50 to -10).
- We sell when the CCI crosses above the sell threshold (10 to 50).
When we “optimize” this we get 200 different simulations:
The first three columns show the variables we put into the formula. The rest of the columns are trading strategy metrics.
The table doesn’t contain all the results but only the best 20% ranked on the profit factor. We tried with wider observations in the CCI but no matter what we couldn’t get much better results than a profit factor of 1.6. This is lower than our minimum requirement of 1.75.
CCI trading strategy no. 2
Based on the simulations we decided to backtest the CCI indicator by using a 9-day lookback period and a buy threshold of -90. We sell when the close is above yesterday’s high. However, this is a backtest that might be susceptible to curve fitting.
Based on the requirements we get the following equity curve:
The CCI trading strategy has a profit factor of about 1.75 and the average gain per trade is 0.42%. Max drawdown is a modest 23%. The result is pretty good, but not good enough to be traded. We would prefer to use other trading indicators that show better backtests:
Moreover, we present our best trading strategies for our paying subscribers.
The code for the CCI trading strategy and over 100 hundred other trading ideas can be purchased for a small fee. Some of the strategies have Tradestation code. All come with descriptions in plain English. Please click on the banner below to read more or order:
CCI indicator – ending remarks
The CCI indicator (Commodity Channel Index) is one of many oscillating trading indicators and many of them are pretty similar. The CCI indicator is good, but there are better, for example, the RSI indicator.