Lean  $LEAN_TAG$
QuantConnect.Indicators.LinearWeightedMovingAverage Class Reference

Represents the traditional Weighted Moving Average indicator. The weight are linearly distributed according to the number of periods in the indicator. More...

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

Public Member Functions

 LinearWeightedMovingAverage (string name, int period)
 Initializes a new instance of the LinearWeightedMovingAverage class with the specified name and period More...
 
 LinearWeightedMovingAverage (int period)
 Initializes a new instance of the LinearWeightedMovingAverage 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

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

Additional Inherited Members

- 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 Weighted Moving Average indicator. The weight are linearly distributed according to the number of periods in the indicator.

For example, a 4 period indicator will have a numerator of (4 * window[0]) + (3 * window[1]) + (2 * window[2]) + window[3] and a denominator of 4 + 3 + 2 + 1 = 10

During the warm up period, IsReady will return false, but the LWMA will still be computed correctly because the denominator will be the minimum of Samples factorial or Size factorial and the computation iterates over that minimum value.

The RollingWindow of inputs is created when the indicator is created. A RollingWindow of LWMAs is not saved. That is up to the caller.

Definition at line 34 of file LinearWeightedMovingAverage.cs.

Constructor & Destructor Documentation

◆ LinearWeightedMovingAverage() [1/2]

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

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

Parameters
nameThe name of this indicator
periodThe period of the LWMA

Definition at line 47 of file LinearWeightedMovingAverage.cs.

◆ LinearWeightedMovingAverage() [2/2]

QuantConnect.Indicators.LinearWeightedMovingAverage.LinearWeightedMovingAverage ( int  period)

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

Parameters
periodThe period of the LWMA

Definition at line 57 of file LinearWeightedMovingAverage.cs.

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.LinearWeightedMovingAverage.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 LinearWeightedMovingAverage.cs.

Member Data Documentation

◆ WarmUpPeriod

int QuantConnect.Indicators.LinearWeightedMovingAverage.WarmUpPeriod => Period

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

Definition at line 40 of file LinearWeightedMovingAverage.cs.


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