Summary

Returns Time Series Moving Average indicator instance.

Syntax

TimeSeriesMovingAverage(DataSeries source, int periods)

Parameters

Example

 
//...
[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()//This could be OnBar() also.
{
    if (tsmfast.Result.LastValue > tsmslow.Result.LastValue)
    //If TimeSeriesMovingAverage with period 14 moves above TimeSeriesMovingAverage with period 24 then
    {
        //Do something
    }
}
//...