Summary

Returns the Standard Deviation indicator instance.

Syntax

StandardDeviation(DataSeries source, int periods, double standardDeviations, MovingAverageType maType)

Parameters

Example

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

[Parameter(DefaultValue = 20)]
public int period { get; set; }

[Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType MAType { get; set; }

[Parameter(DefaultValue = 1.5)]
public double std { get; set; }

private StandardDeviation sd;

protected override void OnStart()
{
    sd = Indicators.StandardDeviation(Source, period, std, MAType);
}

protected override void OnTick()//This could be OnBar().
{
    if (sd.Result.LastValue > sd.Result.LastValue - 1)//If StandardDeviation has increased
    {
        //Do something
    }
}
//...