Lean  $LEAN_TAG$
QuantConnect.Indicators.CommodityChannelIndex Class Reference

Represents the traditional commodity channel index (CCI) More...

Inheritance diagram for QuantConnect.Indicators.CommodityChannelIndex:
[legend]

Public Member Functions

 CommodityChannelIndex (int period, MovingAverageType movingAverageType=MovingAverageType.Simple)
 Initializes a new instance of the CommodityChannelIndex class More...
 
 CommodityChannelIndex (string name, int period, MovingAverageType movingAverageType=MovingAverageType.Simple)
 Initializes a new instance of the CommodityChannelIndex class More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => TypicalPriceAverage.IsReady && TypicalPriceMeanDeviation.IsReady
 Gets a flag indicating when this indicator is ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeNextValue (IBaseDataBar input)
 Computes the next value of this indicator from the given state More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.BarIndicator
 BarIndicator (string name)
 Creates a new TradeBarIndicator with the specified name More...
 

Properties

MovingAverageType MovingAverageType [get]
 Gets the type of moving average More...
 
IndicatorBase< IndicatorDataPointTypicalPriceAverage [get]
 Keep track of the simple moving average of the typical price More...
 
IndicatorBase< IndicatorDataPointTypicalPriceMeanDeviation [get]
 Keep track of the mean absolute deviation of the typical price More...
 
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
- Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

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).

Definition at line 32 of file CommodityChannelIndex.cs.

Constructor & Destructor Documentation

◆ CommodityChannelIndex() [1/2]

QuantConnect.Indicators.CommodityChannelIndex.CommodityChannelIndex ( int  period,
MovingAverageType  movingAverageType = MovingAverageType.Simple 
)

Initializes a new instance of the CommodityChannelIndex class

Parameters
periodThe period of the standard deviation and moving average (middle band)
movingAverageTypeThe type of moving average to be used

Definition at line 59 of file CommodityChannelIndex.cs.

◆ CommodityChannelIndex() [2/2]

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

Initializes a new instance of the CommodityChannelIndex class

Parameters
nameThe name of this indicator
periodThe period of the standard deviation and moving average (middle band)
movingAverageTypeThe type of moving average to be used

Definition at line 70 of file CommodityChannelIndex.cs.

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.CommodityChannelIndex.ComputeNextValue ( IBaseDataBar  input)
protected

Computes the next value of this indicator from the given state

Parameters
inputThe input given to the indicator
Returns
A new value for this indicator

Definition at line 94 of file CommodityChannelIndex.cs.

◆ Reset()

override void QuantConnect.Indicators.CommodityChannelIndex.Reset ( )

Resets this indicator to its initial state

Definition at line 115 of file CommodityChannelIndex.cs.

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.CommodityChannelIndex.IsReady => TypicalPriceAverage.IsReady && TypicalPriceMeanDeviation.IsReady

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

Definition at line 82 of file CommodityChannelIndex.cs.

Property Documentation

◆ MovingAverageType

MovingAverageType QuantConnect.Indicators.CommodityChannelIndex.MovingAverageType
get

Gets the type of moving average

Definition at line 42 of file CommodityChannelIndex.cs.

◆ TypicalPriceAverage

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.CommodityChannelIndex.TypicalPriceAverage
get

Keep track of the simple moving average of the typical price

Definition at line 47 of file CommodityChannelIndex.cs.

◆ TypicalPriceMeanDeviation

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.CommodityChannelIndex.TypicalPriceMeanDeviation
get

Keep track of the mean absolute deviation of the typical price

Definition at line 52 of file CommodityChannelIndex.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.CommodityChannelIndex.WarmUpPeriod
get

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

Definition at line 87 of file CommodityChannelIndex.cs.


The documentation for this class was generated from the following file: