Summary

Returns the Exponential Moving Average Indicator instance.

Syntax

ExponentialMovingAverage(DataSeries source, int periods)

Parameters

Example

//...
[Parameter]
public DataSeries Source { get; set; }

[Output("Result", Color = Colors.Orange)]
public IndicatorDataSeries Result { get; set; }
[Output("previousResult", Color = Colors.Green)]
public IndicatorDataSeries previousResult { get; set; }

private ExponentialMovingAverage ema;

protected override void Initialize()
{
    ema = Indicators.ExponentialMovingAverage(Source, 50);
}
public override void Calculate(int index)
{
    Result[index] = ema.Result[index]; //This stores current ema to Result Output
    previousResult[index] = ema.Result[index-1]; //This stores previous ema to previousResult Output
}
//...