Commodity Channel Index Formula

The commodity channel index formula calculates the mean deviation of the daily average price from the moving average. A value above 100 indicates that the commodity is overbought, and a value below -100 indicates that the commodity is oversold.

Chart.DataManipulator.FinancialFormula(
    FinancialFormula.CommodityChannelIndex,
    "Period",
    "High,Low,Close",
    "CCI")

This formula takes one optional parameter.

Period

Period for calculating the commodity channel index. The default value is 10.

This formula takes three input Y values.

High

Daily high price.

Low

Daily low price.

Close

Daily close price.

This formula outputs one Y value.

CCI

Commodity channel index.

The Line chart type is a convenient chart type to display the formula output.

The following example takes input from Series1's Y values for high, low, and close prices, respectively (Series1:Y,Series1:Y2,Series1:Y3), and outputs the relative strength indicator on Series3 (Series3:Y). It also specifies a period of 15 days.

Chart1.DataManipulator.FinancialFormula (FinancialFormula.CommodityChannelIndex, "15", "Series1:Y,Series1:Y2,Series1:Y3", "Series3:Y");
Show: