Lean  $LEAN_TAG$
QuantConnect.Indicators.ExponentialMovingAverage Class Reference

Represents the traditional exponential moving average indicator (EMA). When the indicator is ready, the first value of the EMA is equivalent to the simple moving average. After the first EMA value, the EMA value is a function of the previous EMA value. Therefore, depending on the number of samples you feed into the indicator, it can provide different EMA values for a single security and lookback period. To make the indicator values consistent across time, warm up the indicator with all the trailing security price history. More...

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

Public Member Functions

 ExponentialMovingAverage (string name, int period)
 Initializes a new instance of the ExponentialMovingAverage class with the specified name and period More...
 
 ExponentialMovingAverage (string name, int period, decimal smoothingFactor)
 Initializes a new instance of the ExponentialMovingAverage class with the specified name and period More...
 
 ExponentialMovingAverage (int period)
 Initializes a new instance of the ExponentialMovingAverage class with the default name and period More...
 
 ExponentialMovingAverage (int period, decimal smoothingFactor)
 Initializes a new instance of the ExponentialMovingAverage class with the default name and period More...
 
override void Reset ()
 Resets this indicator to its initial state More...
 

Static Public Member Functions

static decimal SmoothingFactorDefault (int period)
 Calculates the default smoothing factor for an ExponentialMovingAverage indicator More...
 

Public Attributes

int WarmUpPeriod => _period
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
override bool IsReady => Samples >= _period
 Gets a flag indicating when this indicator is ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeNextValue (IndicatorDataPoint input)
 Computes the next value of this indicator from the given state More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.Indicator
 Indicator (string name)
 Initializes a new instance of the Indicator class using the specified name. More...
 

Additional Inherited Members

- Properties inherited from QuantConnect.Indicators.Indicator
static int DefaultWindowSize = 2 [get]
 The default size of the history window for the indicator 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 exponential moving average indicator (EMA). When the indicator is ready, the first value of the EMA is equivalent to the simple moving average. After the first EMA value, the EMA value is a function of the previous EMA value. Therefore, depending on the number of samples you feed into the indicator, it can provide different EMA values for a single security and lookback period. To make the indicator values consistent across time, warm up the indicator with all the trailing security price history.

Definition at line 27 of file ExponentialMovingAverage.cs.

Constructor & Destructor Documentation

◆ ExponentialMovingAverage() [1/4]

QuantConnect.Indicators.ExponentialMovingAverage.ExponentialMovingAverage ( string  name,
int  period 
)

Initializes a new instance of the ExponentialMovingAverage class with the specified name and period

Parameters
nameThe name of this indicator
periodThe period of the EMA

Definition at line 44 of file ExponentialMovingAverage.cs.

◆ ExponentialMovingAverage() [2/4]

QuantConnect.Indicators.ExponentialMovingAverage.ExponentialMovingAverage ( string  name,
int  period,
decimal  smoothingFactor 
)

Initializes a new instance of the ExponentialMovingAverage class with the specified name and period

Parameters
nameThe name of this indicator
periodThe period of the EMA
smoothingFactorThe percentage of data from the previous value to be carried into the next value

Definition at line 55 of file ExponentialMovingAverage.cs.

◆ ExponentialMovingAverage() [3/4]

QuantConnect.Indicators.ExponentialMovingAverage.ExponentialMovingAverage ( int  period)

Initializes a new instance of the ExponentialMovingAverage class with the default name and period

Parameters
periodThe period of the EMA

Definition at line 67 of file ExponentialMovingAverage.cs.

◆ ExponentialMovingAverage() [4/4]

QuantConnect.Indicators.ExponentialMovingAverage.ExponentialMovingAverage ( int  period,
decimal  smoothingFactor 
)

Initializes a new instance of the ExponentialMovingAverage class with the default name and period

Parameters
periodThe period of the EMA
smoothingFactorThe percentage of data from the previous value to be carried into the next value

Definition at line 77 of file ExponentialMovingAverage.cs.

Member Function Documentation

◆ SmoothingFactorDefault()

static decimal QuantConnect.Indicators.ExponentialMovingAverage.SmoothingFactorDefault ( int  period)
static

Calculates the default smoothing factor for an ExponentialMovingAverage indicator

Parameters
periodThe period of the EMA
Returns
The default smoothing factor
Here is the caller graph for this function:

◆ Reset()

override void QuantConnect.Indicators.ExponentialMovingAverage.Reset ( )

Resets this indicator to its initial state

Definition at line 97 of file ExponentialMovingAverage.cs.

Here is the caller graph for this function:

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.ExponentialMovingAverage.ComputeNextValue ( IndicatorDataPoint  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 108 of file ExponentialMovingAverage.cs.

Member Data Documentation

◆ WarmUpPeriod

int QuantConnect.Indicators.ExponentialMovingAverage.WarmUpPeriod => _period

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

Definition at line 37 of file ExponentialMovingAverage.cs.

◆ IsReady

override bool QuantConnect.Indicators.ExponentialMovingAverage.IsReady => Samples >= _period

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

Definition at line 92 of file ExponentialMovingAverage.cs.


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