CCI
- commodity channel index

Indicators


SYNTAX CCI( periods = 14 )
CCIa( array, periods = 14 )
RETURNS ARRAY
FUNCTION Calculates the Commodity Channel Index (using periods averaging range ).
Second version (CCIa) accepts input array, so CCI can be applied to array different than close. (CCIa exists in AFL 2.2+ only (v.4.20+))
EXAMPLE CCI( 14 )
CCIa( High, 14 );
SEE ALSO  

Comments:

Tomasz Janeczko
tj --at-- amibroker.com
2003-09-03 04:24:35
CCI uses internally 'Avg' built-in price array.
'Avg' is also known as typical price:
Avg = ( H + L + C ) /3

So
CCI( period ) is equivalent to CCia( Avg, period ).

Therefore if you want to calculate CCI from Foreign ticker you should overwrite Avg array,
instead of OHLC:

Avg = ( Foreign("!VIX", "H") + Foreign("!VIX", "L") + Foreign("!VIX", "C") ) / 3;
cc = CCI(period);

Alternativelly use CCIa that takes array directly:

cc = CCIa( Foreign("!VIX", "H") + Foreign("!VIX", "L") + Foreign("!VIX", "C") ) / 3, period);

References:

The CCI function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference