Compartilhar via


Commodity Channel Index Formula (Chart Controls)

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.

Sample plot of the commodity channel index

Formula Details

Syntax

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

Parameters

This formula takes one optional parameter.

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

Input Values

This formula takes three input Y values.

  • High
    Daily high price.
  • Low
    Daily low price.
  • Close
    Daily close price.

Output Value

This formula outputs one Y value.

  • CCI
    Commodity channel index.

Remarks

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

Example

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")
Chart1.DataManipulator.FinancialFormula (FinancialFormula.CommodityChannelIndex, "15", "Series1:Y,Series1:Y2,Series1:Y3", "Series3:Y");

See Also

Reference

System.Windows.Forms.DataVisualization.Charting
System.Web.UI.DataVisualization.Charting

Concepts

Financial Formulas
Applying Formulas