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
periodintThe 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
Properties
Intercept
The point where the regression line crosses the y-axis (price-axis)
public IndicatorBase Intercept { get; }
Property Value
Slope
The regression line slope
public IndicatorBase Slope { get; }
Property Value
WarmUpPeriod
Required period, in data points, for the indicator to be ready and fully initialized.
public override int WarmUpPeriod { get; }
Property Value
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
timeWindowIReadOnlyWindow<long>windowIReadOnlyWindow<DoubleArray>timelonginputDoubleArrayThe 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()