Table of Contents

Class LeastSquaresMovingAverage

Namespace
FinanceSharp.Indicators
Assembly
FinanceSharp.dll

The Least Squares Moving Average (LSMA) first calculates a least squares regression line over the preceding time periods, and then projects it forward to the current period. In essence, it calculates what the value would be if the regression line continued. Source: https://rtmath.net/helpFinAnalysis/html/b3fab79c-f4b2-40fb-8709-fdba43cdb363.htm

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

Constructors

LeastSquaresMovingAverage(int)

Initializes a new instance of the LeastSquaresMovingAverage class.

public LeastSquaresMovingAverage(int period)

Parameters

period int

The number of data points to hold in the window.

LeastSquaresMovingAverage(string, int)

Initializes a new instance of the LeastSquaresMovingAverage class.

public LeastSquaresMovingAverage(string name, int period)

Parameters

name string

The name of this indicator

period int

The number of data points to hold in the window

Properties

Intercept

The point where the regression line crosses the y-axis (price-axis)

public IndicatorBase Intercept { get; }

Property Value

IndicatorBase

Slope

The regression line slope

public IndicatorBase Slope { get; }

Property Value

IndicatorBase

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 of 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>
time long
input DoubleArray

The input given to the indicator

Returns

DoubleArray

A new value for this indicator

Reset()

Resets this indicator and all sub-indicators (Intercept, Slope)

public override void Reset()