CCI (Function)
The CCI function, (Commodity Channel Index) returns the Commodity Channel Index.
Syntax
CCI(Length)
Returns (Double)
A numeric value for the current bar.
Parameters
Name |
Type |
Description |
Length |
Numeric |
Sets the number of trailing bars for the CCI to analyze at a time. |
Remarks
The CCI value usually does not fall outside the -300 to 300 range and is normally in the -100 to 100 range.
The value for the Length input parameter should always be a whole number greater than 0.
The CCI is calculated by determining the difference between the average price of a commodity and the average of the average prices over some number of bars.
This difference is then compared to the average difference over the same time period, to factor in the commodity's volatility. The result is then multiplied by a constant that is designed to adjust the CCI so that it fits into a normalized range of about +/-100.
Traditionally there are two basic methods of interpreting the CCI, looking for divergences, or treating it as an overbought/oversold oscillator.
Example
Assigns to Value1 and plots a 20 bar CCI value for each bar, then plots Value1:
Value1 = CCI(20);
Plot1(Value1, "CCI");
Reference
Lamber, Donald R. "Commodity Channel Index" Commodities Magazine. October 1980. Pgs. 40-41.