StandardDeviation


Summary

The Standard Deviation indicator shows volatility.

Syntax

public StandardDeviation StandardDeviation(DataSeries source, int periods, MovingAverageType maType)

Parameters

NameDescription

Example 1

[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; }
private StandardDeviation sd;
private double previousValue;
protected override void OnStart()
{
    sd = Indicators.StandardDeviation(Source, Period, MAType);
    previousValue = sd.Result.LastValue;
}
protected override void OnBar() 
{
    //If StandardDeviation has increased
    if (sd.Result.LastValue > previousValue) 
    {
        //Do something
    }
    //...
    previousValue = sd.Result.LastValue;
}