CommodityChannelIndex
indicator and
calculates the values of the commodityChannelIndex indicator over all subperiods of a
given length.
Visual Basic (Declaration)  

Public Overloads Shared Function CommodityChannelIdxOverPeriod( _ ByVal s As Series, _ ByVal lengthOfPeriod As Integer _ ) As Series 
Visual Basic (Usage)  Copy Code 


C#  

public static Series CommodityChannelIdxOverPeriod( Series s, int lengthOfPeriod ) 
Parameters
 s
 A series where the first element is the high in the last trading period, the second term is the high in the previous period and so on.
 lengthOfPeriod
 An integer which represents the length of the period over which the indicator will be iteratively evaluated.
Exception  Description 

ArgumentException  Thrown if any elements from the highs, lows or closes are strictly negative, or if the length of the arrays is not equal or the lengthOfPeriod is grater than the length of the array high. 
Lambert originally commended that the CCI was designed to capture the trade cycle (i.e. lowtolow or hightohigh) turns in commodity markets. The system assumes that commodities move in cycles and uses 1/3 of the cycle period for the evaluation of the CCI. We allow the uses to specify the length of the calculation period used but we advise that you take the calculation cycle to be approximately one third of your estimate for the length of the trade cycle.
Calculation Period: the number of days used in the evaluation of the CCI. In Donald Lambert's original system this was taken to be one third of the estimate length of the trade cycle.
Remark: Within the evaluation procedure (step 2), we multiply the result by the constant 0.015. The constant was originally used in Lambert's system and has been found to ensure that around 7080 percent of all the values given by the CCI lie the range [100,+100]. Hence, the constant is just used to calibrate the indicator with respect to the range [100, +100].
Interpretation
Significant signals are generated when either the CCI starts to diverge
from the price action which will signify a correlation in the price,
or when the CCI extended (typically above 100 or below 100) which
indicates oversold or over brought conditions.
Further details concerning the CCI can be found in an article by Donald Lambert that appeared in the October 1980 issue of Commodities (now known as Futures) Magazine.
Evaluation Procedure
We summaries our basic evaluation procedure by the following three steps: