- Tucker Report - http://tuckerreport.com -
CCI – Making it better
Posted By Doug Tucker On July 5, 2007 @ 10:05 pm In | Comments Disabled
This first thing to be done in trying to make the CCI a better indicator is to go to the second line of the code (please refer to previous article  for code) and understand what the simple moving average is there for. I’m not going to get into how a moving average is calculated as that’s usually the first chapter in any book on technical analysis, and there are plenty of resources on the internet. However, most discussions on moving averages don’t discuss what a moving average really does, other than to say you buy when prices cross over it, or buy when two moving averages cross over each other. I think that’s incorrect. I view a moving average as a filter. To me the purpose is to filter out the noise of the market, and to pass through the trend. Admittedly there can be many cycles at play at any given time. Filtering the noise can mean different things to different traders; from filtering out the minor noise leaving a short-term trend, to filtering out all the little cycles and leaving only the longest trend. I plan to delve into cycles and moving average filtering in more detail in a later article, but I need to touch on the subject here only briefly because it is key to turning the CCI from a so so indicator to a really good indicator. Moving averages in general are more successfully employed in trading when used as support and resistance, rather than for crossovers. Sort of like a moving or live trend line. You of course want to be on the correct side of the trend, but pullbacks to the trend and then trend resumption are far more profitable, in my opinion, than trading crossovers. Trading pullbacks is the theory of the zero line reject, discussed in the previous article, as well as Linda Raschke’s grail trade, and many other pullback-within-trend approaches.
The CCI was designed with the simple moving average (right there in the second line of the code) as a filter to pass the trend on to the rest of the formula so the mean deviation could be calculated based on this filtered result. I recall very early software packages having a 30 period CCI, but more common today is the 20 period. Most technicians believe that the ideal parameter for the CCI to be the length of one full cycle. A cycle is usually defined as the number of bars from low to low. If you measure from high to high there is not as much accuracy as there is usually translation of the tops of the cycles either left or right depending on the trend direction. Most momentum oscillators use a half cycle length as the input parameter. Since the CCI uses a moving average up front, a full cycle would be better to filter out the noise. There are some references on the internet that suggest Lambert originally intended the use of 1/3 of a cycle. I attended many seminars in the early 1980’s with much discussion on the relatively new CCI, and the full cycle length was universally accepted. I think the discrepancy is due to the fact that Lambert designed the CCI on a hand calculator without the means to test using a PC and trading software, which became available later. I think some of the contradictions on the internet are referencing his earliest writing. His idea of trading breakouts of the 100 lines, which was his original intent, would not be logical with a very short parameter. Once he could plot and test his results he would realize that the CCI would not stay long enough beyond the 100 lines to get the results he intended. But his original idea does become viable with a longer parameter. Since Lambert’s original idea tested out so poorly most traders began to use the indicator in an entirely different way than what was originally intended. Most traders seemed to use if for divergences, and for strategies involving re-entering the 100 lines, instead of breakouts beyond them. The 20 period lookback period became default in most software packages since most traders in the early days of trading software tested on daily data, and many would assume a 20 or 21 day cycle, as that is the number of trading days in a calendar. Of course cycles expand and contract, and don’t pay much attention to the calendar. The common use today in most chat rooms is to use a 14 period CCI, at least on intraday data. In my opinion, if you trade on a 14 period CCI you are trading mostly on noise. Sometimes the signals will work, but it is mostly by random chance if they do. Sometimes the cycles tighten up to be only 14 bars in length, but then the market is in chop and you probably shouldn’t be trading it unless you have a very short term scalping method.
Refer to the chart above. The blue line under the price bars represents an estimate of what the cycle is based on a formula that attempts to extract the dominant cycle that is developing. It gives a very rough estimate of the developing cycle. It is not exact. A more accurate cycle measure would probably be a fast fourier transform, but that method is useless for trading as it takes many cycles before an estimate can be had, and by then the cycle will certainly have changed. The best we can do is get in the ballpark. There are many formulas to try to determine the cycle period. John Ehlers  has done much excellent work in this area and I have a link to his website on my resources tab, as well as reference to a couple of his books on my book tab. Many of his formulas are written out on either his web site or in his books, and probably elsewhere on the internet. The formula I’m using in the above chart is from one of his earlier attempts.
Here is another example. This chart I will use for the rest of the examples below.
In the above chart you can see a reference line at the bottom drawn at the 14 level. There is only one instance on this chart where this formula determined the cycle period to be as short as 14 bars. You can see it on the left side of the chart, and if you look up to the price bars you see the market is in chop for the moment. As prices come out of chop and start to descend you see the cycle period increasing. At that point in the price action the formula doesn’t know prices will stop and reverse, thus introducing a cycle component based on the new pivot. In this case cycle period quickly reverses and returns to a more normal 30 or so. Had prices continued to drop the cycle period would have stayed high. Actually the cycle component would be removed entirely if prices kept going, so it’s best to put a maximum and minimum value into the formula. You can see as prices start to make an impulse move the cycle extends to a longer period, and as prices lose direction and flatten or reverse the cycle period shortens.
The above chart shows the prices bars with the standard 14 period CCI under it. I used an intraday tick chart for this example. The same principle applies to minute based charts, daily charts, monthly charts, or any chart. The cycles on an intraday chart are a little more erratic than on a daily chart so for the purpose of visual explanation the intraday chart will make the example more obvious to see. I’m not advocating or implying that this method lends itself more to daytrading. In fact the John Ehlers’ references are all on daily based charts. I’ve included some numbers on the CCI subgraph for reference to subsequent charts.
Compare the above chart with the previous chart. This is exactly the same CCI formula, but instead of using the static 14 parameter, I used the full cycle period measure from the code that produced the blue line in the first chart at the top of the page. Observe how much more clearly the patterns on the CCI become. At reference #1 the 14 period CCI isn’t telling me much of anything, but on the next chart, that I’ll refer to from here on as the adaptive CCI, you can see two inverse head and shoulders patterns, one inside the other. Observe the lines drawn on the necklines. The pattern doesn’t exist on the 14 period CCI. At point #2 again there isn’t much of a signal on the 14 period CCI chart, but on the adaptive CCI chart there is a nice reversal of momentum as the CCI approaches the zero basis line, giving a good place to enter on the bullflag on the price bars. Point #3 on the 14 period was again a mess, but on the adaptive chart there was a clear divergence with a hook around the 100 line. This played out again at point #4.
On the above chart I’ve taken one more step to help visually clear up the CCI patterns. I’ve taken the adaptive CCI and smoothed it with a very short term moving average. This takes out most of the little wiggles and creates a much smoother line. But there is a price to be paid for the smoothing as there always is when applying a moving average. There is a little lag. I find about half the time by smoothing the CCI the signal will be delayed by one bar. The other side of the coin is there are far fewer whipsaws. I have more to say on this subject in the next article, which is on application of the CCI. The type and length of the moving average should be chosen based on how smooth you want the CCI to be based on your own experimentation.
On the above chart in the upper subgraph you’ll see the same adaptive CCI that has the moving average component. In addition I added a second moving average, the blue line, as a signal line, much like the signal line in an MACD. In the bottom subgraph I detrended the CCI on that moving average, so the zero line on the indicator in the bottom subgraph is the same as the blue line on the CCI in the top subgraph. It’s as if I pulled the blue line in the top graph like a string so it’s tight. Then the CCI line readjusts itself around the moving average. This method has some application when trading divergences. For example, observe the inverted head and shoulders after point #1. You can see on the right shoulder that the detrended CCI on the bottom was already positive and gave a clear reversal up when the CCI in the upper graph broke its neckline. Point #4 was also confirmed in a similar way. Point #3 had gone slightly positive for only a couple of bars, but the detrended CCI had been under the zero line for some time as that divergence was forming. The detrended CCI did not help the signal at point #2. Again, this method of detrending is only useful as confirmation for some types of signals. I offer it here as something to experiment with, however you might not find it to be of enough use to warrant taking up screen space, unless you trade divergences, or patterns that have a divergence component.
The above chart is a recap of where we started, with the 14 period CCI in the top subgraph, and the smoothed adaptive CCI in the bottom subgraph. Personally, I can’t make any sense of the CCI on the top subgraph, but the CCI on the bottom has some nice clean patterns that I can see at a glance. Go to next article  on CCI application.
Article printed from Tucker Report: http://tuckerreport.com
URL to article: http://tuckerreport.com/indicators/cci-improvement/
URLs in this post:
 previous article: http://tuckerreport.com/indicators/cci-basic/
 John Ehlers: http://www.mesasoftware.com/
 next article: http://tuckerreport.com/indicators/cci-application/
Copyright © 2010 Tucker Report. All rights reserved.