Table of Contents

Class LinearWeightedMovingAverage

Namespace
FinanceSharp.Indicators
Assembly
FinanceSharp.dll

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.

public class LinearWeightedMovingAverage : WindowIndicator, IIndicator, IUpdatable
Inheritance
LinearWeightedMovingAverage
Implements
Inherited Members
Extension Methods

Constructors

LinearWeightedMovingAverage(int)

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

public LinearWeightedMovingAverage(int period)

Parameters

period int

The period of the LWMA

LinearWeightedMovingAverage(string, int)

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

public LinearWeightedMovingAverage(string name, int period)

Parameters

name string

The name of this indicator

period int

The period of the LWMA

Properties

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(IReadOnlyWindow<long>, IReadOnlyWindow<DoubleArray>, long, DoubleArray)

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

protected override DoubleArray Forward(IReadOnlyWindow<long> timeWindow, IReadOnlyWindow<DoubleArray> window, long time, DoubleArray input)

Parameters

timeWindow IReadOnlyWindow<long>
window IReadOnlyWindow<DoubleArray>

The window of data held in this indicator

time long
input DoubleArray

The input value to this indicator on this time step

Returns

DoubleArray

A new value for this indicator