Summary

Returns the Bollinger Bands indicator instance.

Syntax

BollingerBands(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 BollingerBands bb;

protected override void OnStart()
{
    bb = Indicators.BollingerBands(Source, period, std, MAType);
}
protected override void OnTick()//This could be OnBar().
{
    if (bb.Top.LastValue > Symbol.Bid)
    {
        Print("Bid price is bigger than the Top Bollinger Band");
    }
}
//...