Log in

CCI mod

CCI mod
By JohnLast 3324 days ago Comments (18)


This is a mod of the CCI. The idea behind this mod is that the CCI formula uses a constant. Well why a constant? 

This is the biggest secret about this indicator why do we have to use a constant in the formula.

As the formula is:

CCI = (Typical Price - 20-period SMA of TP) / (.015 x Mean Deviation) 

Hmmm, why 0.015?

The CCI was created by Lambert. His idea was to use a multiplier 0.015, so as a result 70% to 80 % of the price action would remain within -1oo and +100.

So this is a containment range. Within this channel or containement range we expect most of the price action to be.

If the price goes beyound that range, we are in cases of extreme volatility.

Then comes the question that the markets Labert was contemplating are not the markets of today. So maybe it may be wise to modify the constant, so it becomes a variable and by this it may suits us to try to make a commodity index where 70 % - 80 % of the price action will be.

So here is a shot:

The formula of the mod is:

CCI = (Typical Price - 20-period SMA of TP) / (variable x Mean Deviation)  

От Indicators


  • jaguar1637 3324 days ago

    yep, this constant calculation is very interesting

    I appreciate


  • jaguar1637 3324 days ago

    Is it possible to tune this constant regarding the volatility of the market.

    Means, when the market is volatile, the constant is low , 0.10

    When the market is in range, the constant is back to 0.15 to 0.20

  • JohnLast 3323 days ago

    I think that it is exactly the idea, the variable has to be tuned in a way that 70 - 80 % of the volatility remains within the  -100 +100 for the current time frame.

    That means that for different time frames the variable may be different.

  • JohnLast 3323 days ago

    So if you see the market at the shot, you can easily plot a linear regression line. The CCI when it is volatility tuned will show the places where there is extreme volatility and deviation from the central tendancy.

    The good thing about the CCI is that it does not lure you into believing that it is measuring cycles. Cycles do exist but they are so fragile.

  • MadCow 3322 days ago

    Suppose that you write the CCI this way:

    CCI = (Typical Price - 20-period SMA of TP) / (f x Mean Deviation)  That's the same as

    CCI = (1/f)(Typical Price - 20-period SMA of TP) / ( Mean Deviation) 

    So as long as f is constant, it is just a scale factor for the display. Changing f does not seem to add much information so long as it remains constant. If you wish to include volatility, you could let f be inversely proportional to the ATR, or the standard deviation of typical price, etc.

  • JohnLast 3322 days ago

    That is possible MadCow, even it is a great new idea.

    My idea is much simpler  imagine a trend, we plot the CCI and we need to find such a scale factor that will make 70 - 80 % of the volatility within the limits from -100 to + 100.

  • tovim 3322 days ago

    John ,

    Check this article ,it is an interesting article:http://articles.mql4.com/628



    At the first stage values of "flags" (-1, 0, 1) are defined for each indicator (oscillator). Assuming that one indicator (for example, MACD) produces signals different ways (convergence/divergence, crossing of a zero line, etc.), the program code contains the description of its defining principle. For example, analysis of the oscillator "Williams Percent Range" is implemented so:

    //30. Williams Percent Range
    //Buy: crossing -80 upwards
    //Sell: crossing -20 downwards
    if (iWPR(NULL,piwpr,piwprbar,1)<-80&&iWPR(NULL,piwpr,piwprbar,0)>=-80)
    if (iWPR(NULL,piwpr,piwprbar,1)>-20&&iWPR(NULL,piwpr,piwprbar,0)<=-20)

    After that unique objects of the 'Text' type are formed from the obtained digital values of flags (to avoid duplication of object names current time value is used) and the displayed:

    timeident=TimeCurrent(); //Time to form the unique object name
    for (i=0;i<=29;i++) //Loop for displaying values
    //Forming unique object names
    {ident=DoubleToStr(30-i,0)+" "+DoubleToStr(timeident,0); //Creating objects, indicating their location
    ObjectCreate(ident,OBJ_TEXT,0,timeident,WindowPriceMin()+Point*5*(i+1)); info=DoubleToStr(f[30-i],0); //Forming a text line to be displayed
    ObjectSetText(ident,info,6,"Arial", Black);} //Describing the format of displaying and displaying

    To check the formed packages the program includes "The block of processing a strategy and placing the Main Flag". This block contains conditions providing which the EA must buy (if the Main Flag is equal to 1) and sell (if the Main Flag is equal to -1). If the described conditions are not fulfilled, the Main Flag stays equal to zero and trades are not executed. The EA also contains a block of position closing (it is commented).

    if(f8==1&&f21==1) //Set of conditions, providing which Buy is executed
    flag=1; if(f8==-1&&f21==-1) //Set of conditions, providing which Sell is executed

    Parameters of each indicator (oscillator) are described in the form of variables, which allows their automatic optimization (initial parameters are those generally accepted).

  • JohnLast 3322 days ago

    It is interesting tovim, as a approach thanks for the link. I did not even suspected such an idea.

    I am thinking right now about the box jenkins models. and the afirma indicator.

    I was thinking to use it as an input to bpnn, but as there are two buffers I can't make it.

    The most interesting thing in the box jenkins models is the statistical tests if the model is likely to work or not using the autocorrelation plots. And that makes perfect sense for any neural net model too.

    The question is if are models are likely to work or not at the current market conditions?

    What are the current market conditions?




  • Jack1 3322 days ago

    Hello, all,

    CCI made me a headache for long time. It seem hard to understand it.

    But, the best of CCI is its scale(measurement) reading, 0, 100, 200, -100, -200. It detect how far price is to the base ma line, which tell the momentum of price movement. 

    I just forget "channel", and focus on whether CCI can stay above 200 or 100 or 0 level line. Then, bullish/bearish.

    But, ma line period is key to use CCI, and use CCI to create buy/sell  entry signal and exit signal.

    See my chart : http://www.forexstreet.net/photo/cci-cable-h1-14-5-2012?context=user



  • JohnLast 3322 days ago

    Yes of course, but when you write, failure to stay above 100 line, or failure to keep bullish momentum above 200, why you do so?

    Why 100 would matter and not 127, or 167 line.

    The answer lies within the variable that needed to be tuned to make 70 to 80 % of the volatility within the channel.

    Of course it is just me, and how I see things, after so much time nobody touched this constant as that would be a sacred constant, but it is not.

    In the books Volatility illuminated the author suggested that this was connected in someway with the Chebyshev’s inequality.

    "According to Chebyshev’s inequality, the probability that a value will be more than two standard deviations from the mean (k = 2) cannot exceed 25 percent. Gauss’s bound is 11 percent, and the value for the normal distribution is just under 5 percent. Thus, it is apparent that Chebyshev’s inequality is useful only as a theoretical tool for proving generally applicable theorems, not for generating tight probability bounds."

    So the constant is empirically set to take into account those 70 - 80 % that in practice needed to be within the channel.



  • Jack1 3322 days ago

    Why is +100 line used?  

    This is just practical selection or round number or easy number. Somebody use +150, +250 line as threshold line in cci.

    But, key is watching cci; if cci move above +300, then, you can watch +200 line, if drop below +200 line, it means price fail to maintain the momentum above +200 reading on cci, then, you can exit long.

    If cci move only above +250, then, you can use +200(or +150) as stop loss line. 

    In order to keep a consistentce (or uniform reading) of CCI measure scale, I don't prefer to change the constant in formula of CCI or do fine tune on the constant.  If cci is used on different time frame, with different of ma line, very hard to get uniform channel.  It may be not uniform scale of reading if the formula is fine tuned.

    Of course, many traders can use cci in different ways, then, change or fine tune cci for their purposes. But, how to use cci to generate buy signal/exit signal objectively, effectively may be a problem or a focus.

  • JohnLast 3322 days ago

    I see your point. My point is that you need to fit the CCI regarding the current volatility. Otherwize those levels do not make any sense at all.

    Overbought, and oversold levels are really important stuff, but regarding to what?

    My possible answer is regarding to a linear regression fit (central tendancy).

    Of course there are many other things to be considered in the analysis, but this is normal in the discretionary analysis. 

  • JohnLast 3322 days ago

    I was looking to find the original Donald Lambert's article about the CCI. But I did not find it.

    Anyway most of the stuff you would find on internet is highly rendundant, authors copy each other.

    As stated in the book Volatility illuminated, most articles on the internet are written by copywritters who have nothing to do with the markets. Anyway the book Volatility illuminated remains the sole source of insight information, despite the fact I have a different interpretation, on my own.




  • tovim 3321 days ago

    You can channilize CCI like RSI in this example http://www.forex-tsd.com/setup-questions/14880-rsi-indicator-2.html#post220000

    or add dynamic volatility zones instead of static ones http://www.greattradingsystems.com/Dynamic+Zone+RSI+V5-metatraderindicator

  • tovim 3321 days ago

    Can anyone replace the standart deviation with IVAR in ADX ?   http://codebase.mql4.com/7955

  • JohnLast 3321 days ago

    I am glad with this discussion. I was loocking at google search about the CCI, all the posts are the same. 

    It looks like SEO is detrimental to traders.

  • Jack1 3321 days ago

    Cable 's cci reading show a strong downside momentum, and price has moves over previous distance(gapm == 110 pips) from ma100 line. 

    Chart is here: http://www.forexstreet.net/photo/cci-cable-h1-15-5-2012-2?context=user

    $Million question:  will cable bounce up for mean balance, momentum reshuffle, market makers take their stocks back ?

    You are shorting, but, market makers are buying. Where will Market makers clear off their long positions? They won't be loser.

  • JohnLast 3320 days ago

    I see the shot. It is a bit late to give you an estimate as the market did its own thing.

    Well technical analysis as I see it is not about predicting the future but setting probabilities based on what the market already did.

    Based on that we see a clear channel. So you are correct to presume that the market would bounce up.

    But, but.

    The channel serves also to see the exact point when the scenario is wrong. What really matters is the risk control.

    That is because the market constantly forms channels and violates them.

    So basically traders do not know. What they can do is to bet at the right spot. The spot giving the maximum profit/risk ratio.

    Those spots are exactly at the places where you have no idea really what the market would do, but the scenarios are cristal clear.

    From there is money management, some double the lot in the opposite direction, when they are wrong on the first entry. But it is an art too.