Table of Contents

Class CommodityChannelIndex

Namespace
FinanceSharp.Indicators
Assembly
FinanceSharp.dll

Represents the traditional commodity channel index (CCI)

CCI = (Typical Price - 20-period SMA of TP) / (.015 * Mean Deviation) Typical Price (TP) = (High + Low + Close)/3 Constant = 0.015

There are four steps to calculating the Mean Deviation, first, subtract the most recent 20-period average of the typical price from each period's typical price. Second, take the absolute values of these numbers. Third, sum the absolute values. Fourth, divide by the total number of periods (20).

public class CommodityChannelIndex : BarIndicator, IIndicator, IUpdatable
Inheritance
CommodityChannelIndex
Implements
Inherited Members
Extension Methods

Constructors

CommodityChannelIndex(int, MovingAverageType)

Initializes a new instance of the CommodityChannelIndex class

public CommodityChannelIndex(int period, MovingAverageType movingAverageType = MovingAverageType.Simple)

Parameters

period int

The period of the standard deviation and moving average (middle band)

movingAverageType MovingAverageType

The type of moving average to be used

CommodityChannelIndex(string, int, MovingAverageType)

Initializes a new instance of the CommodityChannelIndex class

public CommodityChannelIndex(string name, int period, MovingAverageType movingAverageType = MovingAverageType.Simple)

Parameters

name string

The name of this indicator

period int

The period of the standard deviation and moving average (middle band)

movingAverageType MovingAverageType

The type of moving average to be used

Properties

IsReady

Gets a flag indicating when this indicator is ready and fully initialized

public override bool IsReady { get; }

Property Value

bool

MovingAverageType

Gets the type of moving average

public MovingAverageType MovingAverageType { get; }

Property Value

MovingAverageType

TypicalPriceAverage

Keep track of the simple moving average of the typical price

public IndicatorBase TypicalPriceAverage { get; }

Property Value

IndicatorBase

TypicalPriceMeanDeviation

Keep track of the mean absolute deviation of the typical price

public IndicatorBase TypicalPriceMeanDeviation { get; }

Property Value

IndicatorBase

WarmUpPeriod

Required period, in data points, for the indicator to be ready and fully initialized.

public override int WarmUpPeriod { get; }

Property Value

int

Methods

Forward(long, DoubleArray)

Computes the next value of this indicator from the given state

protected override DoubleArray Forward(long time, DoubleArray input)

Parameters

time long
input DoubleArray

The input given to the indicator

Returns

DoubleArray

A new value for this indicator

Reset()

Resets this indicator to its initial state

public override void Reset()