14.05.2012 г.

Commodity Channel Index mod


This is a mod of the CCI (Commodity Channel Index) written in mql for the Metatrader 4 plateform (mt4). 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.

The formula of the mod is:

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

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.