- Tucker Report - http://tuckerreport.com -
CCI – Basic understanding
Posted By Doug Tucker On July 5, 2007 @ 10:04 pm In | Comments Disabled
The CCI, or Commodity Channel Index, has gained quite a bit of popularity over the last few years. One chat room started promoting its use. That room had a large following and still does. Several other chat rooms popped up using essentially the same formula and signals. The indicator has grown over the years to possess almost magical powers. It is touted as being a leading indicator. Somehow this indicator can take the high, the low, and the close of a price bar and somehow, through some magic of math become, or I should say, in defiance of all the rules of math, lead the function from which it is derived. Can it really do this? Further, it is said by many that this is the only indicator you need. It is so good that you don’t even need prices on the chart to trade with it.
I think the first thing that needs to be done here is to look at what this indicator really is. Maybe see if it really is a magic indicator, or if not, take some of the magic and mystery out of it. If you look at the code it only consists of a few lines.
Here’s the code:
1. Calculate the Typical Price = (High + Low + Close) / 3
2. Calculate the simple moving average item #1. We’ll call it SMATP.
3. Calculate the Mean Deviation: delta_i = abs(last_SMATP – TP_of_period_i) (for all i from 0 to N, where N is the length of a period used to calculate the SMATP). MD = sum_for_all_i(delta_i) / N
4. Calculate the CCI = (TP – SMATP) / (0.015 * MD)
On the above chart you’ll see a CCI with the input parameter set to 14 bars, which is the common setting in all the chat rooms I’ve been in. This happens to be an intra-day tick chart on the Dow mini-futures, however it could be a 5 minute chart or a daily chart, or any chart. Some traders will extend the 14 parameter out to 20 on longer term charts. Also, most CCI traders use a histogram on the CCI that changes color when indicating an uptrend or downtrend. I left it out for this article for clarity. The zero basis line is purple and the +/- 100 lines are dashed cyan. I put a pink circle on one of the more common patterns, which is referred to as a zero line reject. This occurs when the CCI bounces off the zero line. This would equate to a bounce off a 14 period simple moving average. Saying that blasphemes remark in a CCI chat room will probably get you booted, or at least you’ll receive many nasty comments. The magic indicator with its premier setup couldn’t be as simple as a bounce off of a 14 period simple moving average, could it? Let’s see.
On the above chart I have the same CCI under the prices, but this time in the upper subgraph where the normal price bars were I replaced them with a thick black line that is what is typically referred to as the typical price. This is the first line in the CCI code above. It is simply the average of the high, the low, and the close. We are already introducing a bit of lag into this leading formula. The high and low and close normally don’t occur at the same time on a normal price bar (limit moves excluded) so there is a bit of lag here, however slight it may be. The purple line is the 14 period simple moving average displayed along with the line chart of the typical price. I place the same pink circle on the CCI where the zero line reject is, and placed a circle on the price line in the same spot. You’ll notice that this line bounces off the simple moving average exactly like the CCI bounces off the zero line. Could the zero line be nothing more than a detrended simple moving average? Indeed it is. The moving average is on line #2 of the code above.
On the chart above you’ll see the same CCI in the lower subgraph. The upper chart is the same price line but this time it has been detrended. The black line is the price line, that is the line of the typical price, and the purple line is the moving average. The same moving average as in the previous example, however this time it is pulled tight like a string so the prices will skew around the moving average. It is calculated simply by subtracting the moving average from the price line. Most of the changes in direction of the price line will occur at the same time as the changes in direction of the CCI. The amplitude is somewhat different, however you should notice that the moves around the zero line are identical. I pointed out with the pink circles the one bounce off the zero line at the same time as the bounce off the moving average, which now also becomes a bounce off the zero line of the simple detrended simple moving average. I’m sure you can find many more close relationships between the two.
If I am correct in all this, which simple arithmetic proves me to be, then not only the zero line of the CCI is nothing more than a simple moving average, also the CCI line itself is nothing more than the price detrended. I thought I heard somewhere that you didn’t need prices to trade. But the CCI line is a price line, so we are looking at prices. It is price with a slight modification as each point is the sum of high, low, and close, and then divided by 3, and then skewed a bit so 70% to 80% of the prices fall within a certain range. Lambert chose rather arbitrarily to use the .015 in the denominator by eyeballing different settings until it looked like he had this percentage within the bands. You can experiment with different setting of the .015 number to see how the 100 lines change. Of course you can leave it as is and move those reference lines around to get the same effect. I just wanted to point out how arbitrary those sacred reference numbers are. I would have thought one standard deviation would have made more sense, in which case about 67% would have fallen within the boundaries.
A close approximation of the CCI can be replicated easily by the use of Bollinger Bands, which will eliminate the need for any programming as these bands are included with most software packages and can be plotted right over the price bars.
In the above chart we again have the very same CCI in the bottom subgraph, and I have returned the non-detrended typical price line along with the 14 period simple moving average. This time I added the Bollinger Bands. Again the zero line of CCI is the same as the moving average, and I color coded it so it is easier to reference. I plotted to Bollinger Bands as a dashed cyan line so it can easily be referenced to the plus and minus CCI reference lines. To make them roughly equal I had to of course use the moving average length of 14 and the price input of the typical price instead of just the closing price. I also had to change the default setting of the Bollinger Bands to about 1.25 standard deviations. If one standard deviation is about 67% and two is about 95%, I figured matching Lambert’s idea of roughly 80% containment would require about 1.25. I’m sure my estimation isn’t perfect. I wasn’t trying to get a perfect match. But you can see it is very close. So close that for all practical purposes it is the same. Just look at the excursions outside the CCI bands and then refer to the same spot on the Bollinger Bands. We’ve already established the relationship of the crosses and bounces around the zero line. Now the 100 lines are accounted for.
The added advantage of viewing the Bollinger Bands right on the prices is that you can see the trend at a glance, without having to resort to supporting indicators attempting to identify the trend and its strength. And perhaps even more important, you can see when volatility expands and contracts. Sometimes the CCI will be making nice big moves, just enough to get the CCI traders excited, but prices might not be going anywhere. Tight Bollinger Bands will show this at a glance. Of course, when the bands are tight they usually expand back out as volatility is quite cyclical. At other times the CCI might be hardly moving, but prices making large swings. This is when the bands are wide and prices, relative to the bands, are not making large moves, but in an absolute sense they are. How can you get this information from only looking at the CCI without the advantage of seeing prices?
Now what would happen if we pulled the moving average and Bollinger Bands tight like a string?
The answer is in the chart above. Yes there are slight differences. CCI purists will say they are not at all the same. One uses mean deviation and the other standard deviation, and my parameter for standard deviation was done with a quick eyeball. But I think most rational technicians would say they are derived from the same basic concept, and despite the slight differences, one cannot say one is better than the other.
I may sound critical of the CCI, but I am not. I am critical of the promotion. I think it is a fine indicator, and one that can be made a lot better, which I will deal with in the next article. And the article after that will deal with application. I’ve only dealt with basic construction and understanding. To fully understand this indicator we need to deal with what is being measured, and the possible uses of those measurements. I don’t think it serves any purpose to blindly call any indicator a magic, leading indicator – the only indicator you need to trade, just because people in a chat room build it up to be something that no indicator can possibly be.
Article printed from Tucker Report: http://tuckerreport.com
URL to article: http://tuckerreport.com/indicators/cci-basic/
Copyright © 2010 Tucker Report. All rights reserved.