TimeSeriesMovingAverage


Summary

The Time Series Moving Average is a moving average based on linear regression

Syntax

public TimeSeriesMovingAverage TimeSeriesMovingAverage(DataSeries source, int periods)

Parameters

NameDescription

Example 1

[Parameter]
public DataSeries Source { get; set; }
[Parameter(DefaultValue = 14)]
public int periodfast { get; set; }
[Parameter(DefaultValue = 24)]
public int periodslow { get; set; }
private TimeSeriesMovingAverage tsmfast;
private TimeSeriesMovingAverage tsmslow;
protected override void OnStart()
{
    tsmfast = Indicators.TimeSeriesMovingAverage(Source, periodfast);
    tsmslow = Indicators.TimeSeriesMovingAverage(Source, periodslow);
}
protected override void OnTick()
{
    //If TSMA with period 14 moves above TSMA with period 24 
    if (tsmfast.Result.LastValue > tsmslow.Result.LastValue)
    {
        //Do something
    }
}