Developed by Donald Lambert and featured in Commodities magazine in 1980, the Commodity Channel Index (CCI) is a versatile technical indicator that can be used to identify a new trend or warn of extreme conditions in commodities, indices, cryptocurrencies, stocks and other tradable assets.  You should remember that the CCI indicator is not a good standalone tool. Like any other oscillator, the CCI needs to be combined with an additional trading tool or with multiple time-frames to make a trading strategy.

Introduction

CCI is calculated using the following formula:

CCI = (Typical Price – 14-SMA)/(0.015 x Mean Deviation)

where, Typical Price = (High + Low + Close)/3. Mean Deviation is the average deviation of 20-period average of typical price. 0.015 is a constant to keep majority of CCI values in the 100 to -100 range.

CCI measures the difference between a stock’s typical price change and its average price change over a default look-back period of 14. High positive readings indicate that prices are well above their average, which is a show of strength. Low negative readings indicate that prices are well below their average, which is a show of weakness. As an oscillator, surges above +100 reflect strong price action that can signal the start of an uptrend. Plunges below -100 reflect weak price action that can signal the start of a downtrend.

Technically, CCI favours the bulls when positive and the bears when negative. We’ll be using what is called the minority support and resistant levels of +/- 100 in a slightly different context in two time-frames, to develop our strategy on Mudrex.

Multiple Time-Frames

If you are a short-term trader you might be focusing on short-term charts and trends. If you are a long-term trader you might be focusing on long-term charts and trends. However, when the short-term and long-term trends are in agreement you are probably right to be confident about a trade. This is the level of importance of using multiple time-frames to generate buy and sell signals.

We’ll be using a higher time-frame “trend chart” to define a predominant uptrend or a downtrend using CCI while a volatile lower time-frame “signal chart” to generate buy/sell signals using CCI. Bear in mind that when our trend chart indicates a possible uptrend, we’ll go long-only on our signal chart while when the trend chart indicates a possible downtrend, we’ll go short-only on our signal chart. These signals will be independent of each other while defining the buy/sell paths on the platform.

The following pairs of time-frames can be used to define our own trend/signal charts:

Trend Chart (Predominant)Signal Chart (Volatile)
15 to 30-minute1-minute
1-hour5-minute
4-hour15 to 30-minute
1-day90-minute
1-week1-day
1-month1-week
Time-Frames

More information on the usage of multiple time-frames on Mudrex can be found here.

Long-Only Strategy

As mentioned above, to define the predominant uptrend, we’ll be using a trend chart of a higher time-frame T1. When the CCI moves above +100 on our longer-term chart, this indicates an upward trend, and we only watch for buy-signals on the shorter-term chart. The trend is considered up until the longer-term CCI dips below 0.

On our signal chart of a shorter timeframe T2, we’ll buy when the CCI dips below -100 and then rallies back above -100. It would then be prudent to exit the trade once the CCI moves above +100 and then drops back below +100. Alternatively, if the trend on the longer-term CCI turns down below 0, that indicates a sell signal to exit all long positions.

Short-Only Strategy

When the CCI is below -100 on our longer-term chart (T1), only take short sale signals on the shorter-term chart (T2). The downtrend is in effect until the longer-term CCI rallies above 0.

The chart indicates that we should take a short trade when the CCI rallies above +100 and then drops back below +100 on the shorter-term chart. Traders would then exit the short trade once the CCI moves below -100 and then rallies back above -100. Alternatively, if the trend on the longer-term CCI turns up, exit all short positions.

Building on Mudrex

Since it’s difficult to set appropriate time-frames and keep track of CCI charts in those time-frames, the process can be made a lot easier by automating our trades on Mudrex. Multiple time-frames can be easily defined for different buying/selling ‘paths’ and set while performing a back-test.

Let us first write our entry/exit conditions for our long-only trades

Buy when:

  • CCI > 100 (T1) [AND]
  • CCI crosses up -100 (T2)

Sell when:

  • CCI crosses down +100 (T2) [OR]
  • CCI < 0 (T1)

We’ll use the ‘indicator’ block to ensure that CCI for T1 is more than 100 when we’re generating a buy signal:

We’ll use another ‘indicator’ block to generate a buy signal when CCI for T2 crosses up -100:

We connect these two blocks using an “AND” block and generate an open long position only buy signal:

The long-only buy signal looks like this:

Similarly, a close long position only sell signal can be generated when either CCI (T1) becomes less than 0 “OR” CCI (T2) crosses down 100:

This completes our long-only strategy.

Making the short-only strategy is left as an exercise to you, using the following entry/exit conditions:

Sell when:

  • CCI < -100 (T1) [AND]
  • CCI crosses down 100 (T2)

Buy when:

  • CCI crosses up -100 (T2) [OR]
  • CCI > 0 (T1)

Using the indicator blocks and path definition of open short position only will give us the following sell signal:

Similarly, using a path definition of close short position only gives us the following buy signal:

This completes our short-only strategy.

Overall, the long-short strategy looks like this:

Overall Strategy

There we go!

Note that the strategy does not include a stop-loss, although it is recommended to have a built-in cap on risk to a certain extent. When buying, a stop-loss can be placed below the recent swing low; when shorting, a stop-loss can be placed above the recent swing high.

We can now run back-tests by setting suitable T1 and T2 time-frames on Mudrex. We set a T1 (longer time-frame) of 1-day while a T2 (shorter time-frame) of 90-minutes which gives us the following results for the last 3 months:

1D-90M Backtest on Bitmex BTC/USD over the last 3 months

One interesting thing to note here is that, we can use more than two time-frames to get even more surety of our trades. The third smaller time-frame chart is called a timing chart. Using multiple time-frames provides us with a variety of accurate and useful trading information. Using it wisely will lead to better deals. Better deals lead to more profits.

A lot of even more complex things can be done on Mudrex! Signup today!

Links

A few quick references below:

Happy Trading!