The Commodity Channel Index (CCI) is an underrated momentum indicator that is often overshadowed by the RSI and MACD.
I’ll show you how to build a simple trend following strategy using a pair of CCI indicators!
The complete strategy can be downloaded in the Free Strategies section.
The CCI indicator was invented by Donald Lambert in 1980 to detect cyclical turns in commodities, and has since become one of the most popular momentum indicators.
In essence, it measures the current price relative to an average price over a given lookback period. Unlike most indicators, the CCI uses typical price instead of closing price. Some feel that typical price (TP), calculated as (high+low+close)/3, is more representative of price action.
The formula for a default 20-period CCI is:
The mean deviation is calculated as follows:
With the 20-period lookback, Lambert selected a 0.015 constant for the denominator such that the CCI would fall within the ±100 range 70-80% of the time.
Shorter lookbacks will produce a more volatile CCI, with the indicator often exceeding the ±100 range. Unlike the RSI and Stochastic oscillators, the CCI is unbound, meaning there is no minimum or maximum CCI value.
How Do Traders Use the CCI Indicator?
1. Detecting Overbought/Oversold Conditions
With shorter lookback periods, the CCI is most commonly used as an overbought/oversold indicator.
The CCI +100 level is usually used to indicate an overbought condition, while -100 indicates an oversold condition.
The chart below shows the 20-period CCI applied to the USDCAD, a mostly ranging market.
2. Trend Detection
When a longer lookback period is used, the CCI can be used to detect trends. Values above +100 indicate an uptrend, while values below -100 indicate a downtrend.
Lookback periods in the 60-100 range are generally good for trend detection. I do not recommend anything below 50 for the CCI since it is particularly reactive to price changes.
The chart below shows the 80-period CCI indicating an uptrend in the GBPJPY.
The Dual CCI Trend Strategy
We need a way to exploit both of the CCI’s uses above.
How about a trend following strategy that enters the market on a short-term pullback?
An 80-period CCI will be used for trend detection. We’ll throw in a 5-period CCI to detect short-term overbought/oversold conditions during pullbacks. In this context, the CCI is also being used as a pullback filter.
So a long signal will occur when the 80-period CCI is above +100, and the 5-period CCI is below -100. Rules are symmetrical for the short side.
Wait, what if the pullback eventually turns into a trend reversal? Don’t catch a falling knife!
Since we want to focus on trends that display signs of continuation, we will place buy stops at the previous bar’s high. Sell stops will be placed at the previous low.
The strategy’s pseudocode is as follows:
IF the 80-period CCI is above +100
AND the 5-period CCI is below -100,
THEN Place a buy stop at the previous bar’s high. Order is valid for 3 bars.
Rules are symmetrical on the short side.
I try not to overthink trade management when it comes to trend following strategies. Most successful trend strategies do not use much management; they simply let the trend run till it reverses.
I’ll just use a 200-pip stop loss and trailing stop for trade management.
The CCI strategy was programmed in AlgoWizard as shown:
Dual CCI Trend Strategy Results
I did a 10-year backtest on my favourite trend following market, the GBPJPY.
Seems like the CCI was put to good use! Results are decent for a single-indicator strategy.
Out of curiosity, I decided to optimize the long-term CCI’s lookback period. The lookback period of the entry indicator usually has the largest impact on strategy performance.
I optimized the lookback period from 20 to 200, in steps of 1.
It is encouraging that all 181 optimizations are profitable, and that the average profit is over 9000 pips. This indicates that the strategy parameters are likely stable.
With net profit as the performance metric, the 80-period lookback seems to be in the middle of a high plateau.
This confluence with the optimization results gives me confidence that the strategy is logically sound. In other words, the 5 and 80-period CCIs are likely effective at detecting pullbacks in long-term trends.
Wrapping Up
The versatile CCI deserves a place in the trader’s toolbox. It can be used to detect both trends and pullbacks; all you need to do is vary its lookback period.
One downside of the CCI is its high reactivity to prices. It’s common to see the CCI move from -100 to +100 within a few bars. To combat this, you may choose to apply a smoothing function to the CCI. I have found success using a 5-period SMA of the CCI.
The completely strategy can be downloaded in the Free Strategies section.
GREAT STRATEGY. NEW AND EXPERIENCED TRADERS SHOULD BENEFIT FROM THIS STRATEGY. ALSO, CAN THIS STRATEGY BE USED ON ALL CURRENCY PAIRS AND TIME FRAMES?
Hi Darrell, it’s very difficult to find a strategy that works well on all markets and timeframes. The strategy needs to suit the character of the market. In this case, your best bet is to trade a trending market on the higher timeframes.
thank you for providing the video. i am still learning how to do forex trading, profitably.
i have questions on your strategy’s entry condition.
for long entry, why not CCI (80) > +100 and CCI (5) crossover -100?
is it because of the difficulties in writing the algorithm?
If I use the entry condition
CCI (80) > +100 and CCI (5) crossover -100,
will it works similarly like yours?
This is excellent for accurate price action
Thanks, I agree!
thank you for providing the video. i am still learning how to do forex trading, profitably.
i have questions on your strategy’s entry condition.
for long entry, why not CCI (80) > +100 and CCI (5) crossover -100?
is it because of the difficulties in writing the algorithm?
If I use the entry condition
CCI (80) > +100 and CCI (5) crossover -100,
will it works similarly like yours?
I replied in the Youtube video, please have a look.