Table of Contents

Class SimpleMovingAverage

Namespace
FinanceSharp.Indicators
Assembly
FinanceSharp.dll

Represents the traditional simple moving average indicator (SMA)

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

Constructors

SimpleMovingAverage(int)

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

public SimpleMovingAverage(int period)

Parameters

period int

The period of the SMA

SimpleMovingAverage(string, int)

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

public SimpleMovingAverage(string name, int period)

Parameters

name string

The name of this indicator

period int

The period of the SMA

Properties

IsReady

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

public override bool IsReady { get; }

Property Value

bool

RollingSum

A rolling sum for computing the average for the given period

public IndicatorBase RollingSum { 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 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

Reset()

Resets this indicator to its initial state

public override void Reset()