CommodityChannelIndex


Summary

Calculates a Commodity Channel Index

Remarks

The Commodity Channel Index is used to determine overbought and oversold conditions relating to a symbol. The Commodity Channel Index can be used to forecast changes in price direction.

Syntax

public interface CommodityChannelIndex

Members

NameTypeSummary
Result PropertyCommodity Channel Index Result Series.

Example 1

using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Indicator
{
    [Indicator]
    public class CommodityChannelIndexReferenceExample:Indicator
    {
        private CommodityChannelIndex _commodityChannelIndex;
        [Parameter("Periods", DefaultValue = 14)]
        public int Periods { get; set; }
        	
        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }
        protected override void Initialize()
        {
            _commodityChannelIndex = Indicators.CommodityChannelIndex(Periods);
        }
        public override void Calculate(int index)
        {
            // Display Result of Indicator
            Result[index] = _commodityChannelIndex.Result[index];
        }
    }
}