Lean  $LEAN_TAG$
QuantConnect.Indicators.SimpleMovingAverage Class Reference

Represents the traditional simple moving average indicator (SMA) More...

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

Public Member Functions

override void Reset ()
 Resets this indicator to its initial state More...
 
 SimpleMovingAverage (string name, int period)
 Initializes a new instance of the SimpleMovingAverage class with the specified name and period More...
 
 SimpleMovingAverage (int period)
 Initializes a new instance of the SimpleMovingAverage class with the default name and period More...
 
- Public Member Functions inherited from QuantConnect.Indicators.WindowIndicator< IndicatorDataPoint >
override void Reset ()
 Resets this indicator to its initial state More...
 

Public Attributes

override bool IsReady => RollingSum.IsReady
 Gets a flag indicating when this indicator is ready and fully initialized More...
 
int WarmUpPeriod => Period
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
- Public Attributes inherited from QuantConnect.Indicators.WindowIndicator< IndicatorDataPoint >
int Period
 Gets the period of this window indicator More...
 
override bool IsReady
 Gets a flag indicating when this indicator is ready and fully initialized More...
 
virtual int WarmUpPeriod
 Required period, in data points, to the indicator to be ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeNextValue (IReadOnlyWindow< IndicatorDataPoint > window, IndicatorDataPoint input)
 Computes the next value for this indicator from the given state. More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.WindowIndicator< IndicatorDataPoint >
 WindowIndicator (string name, int period)
 Initializes a new instance of the WindowIndicator class More...
 
override decimal ComputeNextValue (T input)
 Computes the next value of this indicator from the given state More...
 
abstract decimal ComputeNextValue (IReadOnlyWindow< T > window, T input)
 Computes the next value for this indicator from the given state. More...
 

Properties

IndicatorBase< IndicatorDataPointRollingSum [get]
 A rolling sum for computing the average for the given period 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 simple moving average indicator (SMA)

Definition at line 21 of file SimpleMovingAverage.cs.

Constructor & Destructor Documentation

◆ SimpleMovingAverage() [1/2]

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

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

Parameters
nameThe name of this indicator
periodThe period of the SMA

Definition at line 47 of file SimpleMovingAverage.cs.

◆ SimpleMovingAverage() [2/2]

QuantConnect.Indicators.SimpleMovingAverage.SimpleMovingAverage ( int  period)

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

Parameters
periodThe period of the SMA

Definition at line 57 of file SimpleMovingAverage.cs.

Member Function Documentation

◆ Reset()

override void QuantConnect.Indicators.SimpleMovingAverage.Reset ( )

Resets this indicator to its initial state

Definition at line 36 of file SimpleMovingAverage.cs.

Here is the caller graph for this function:

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.SimpleMovingAverage.ComputeNextValue ( IReadOnlyWindow< IndicatorDataPoint window,
IndicatorDataPoint  input 
)
protected

Computes the next value for this indicator from the given state.

Parameters
windowThe window of data held in this indicator
inputThe input value to this indicator on this time step
Returns
A new value for this indicator

Definition at line 68 of file SimpleMovingAverage.cs.

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.SimpleMovingAverage.IsReady => RollingSum.IsReady

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

Definition at line 31 of file SimpleMovingAverage.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.SimpleMovingAverage.WarmUpPeriod => Period

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

Definition at line 77 of file SimpleMovingAverage.cs.

Property Documentation

◆ RollingSum

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.SimpleMovingAverage.RollingSum
get

A rolling sum for computing the average for the given period

Definition at line 26 of file SimpleMovingAverage.cs.


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