|SYNTAX|| CCI( periods = 14 )
CCIa( array, periods = 14 )
|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 );
tj --at-- amibroker.com
|CCI uses internally 'Avg' built-in price array.|
'Avg' is also known as typical price:
Avg = ( H + L + C ) /3
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);
The CCI function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.