Lean  $LEAN_TAG$
QuantConnect.Indicators.BollingerBands Class Reference

This indicator creates a moving average (middle band) with an upper band and lower band fixed at k standard deviations above and below the moving average. More...

Inheritance diagram for QuantConnect.Indicators.BollingerBands:
[legend]

Public Member Functions

 BollingerBands (int period, decimal k, MovingAverageType movingAverageType=MovingAverageType.Simple)
 Initializes a new instance of the BollingerBands class More...
 
 BollingerBands (string name, int period, decimal k, MovingAverageType movingAverageType=MovingAverageType.Simple)
 Initializes a new instance of the BollingerBands class More...
 
override void Reset ()
 Resets this indicator and all sub-indicators (StandardDeviation, LowerBand, MiddleBand, UpperBand, BandWidth, B) More...
 

Public Attributes

override bool IsReady => MiddleBand.IsReady && UpperBand.IsReady && LowerBand.IsReady && BandWidth.IsReady && PercentB.IsReady
 Gets a flag indicating when this indicator is ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeNextValue (IndicatorDataPoint input)
 Computes the next value of the following sub-indicators from the given state: StandardDeviation, MiddleBand, UpperBand, LowerBand, BandWidth, B More...
 
override IndicatorResult ValidateAndComputeNextValue (IndicatorDataPoint input)
 Validate and Compute the next value for this indicator More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.Indicator
 Indicator (string name)
 Initializes a new instance of the Indicator class using the specified name. More...
 

Properties

MovingAverageType MovingAverageType [get]
 Gets the type of moving average More...
 
IndicatorBase< IndicatorDataPointStandardDeviation [get]
 Gets the standard deviation More...
 
IndicatorBase< IndicatorDataPointMiddleBand [get]
 Gets the middle Bollinger band (moving average) More...
 
IndicatorBase< IndicatorDataPointUpperBand [get]
 Gets the upper Bollinger band (middleBand + k * stdDev) More...
 
IndicatorBase< IndicatorDataPointLowerBand [get]
 Gets the lower Bollinger band (middleBand - k * stdDev) More...
 
IndicatorBase< IndicatorDataPointBandWidth [get]
 Gets the Bollinger BandWidth indicator BandWidth = ((Upper Band - Lower Band) / Middle Band) * 100 More...
 
IndicatorBase< IndicatorDataPointPercentB [get]
 Gets the Bollinger B B = (Price - Lower Band)/(Upper Band - Lower Band) More...
 
IndicatorBase< IndicatorDataPointPrice [get]
 Gets the Price level More...
 
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 
- Properties inherited from QuantConnect.Indicators.Indicator
static int DefaultWindowSize = 2 [get]
 The default size of the history window for the indicator More...
 
- Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider
int WarmUpPeriod [get]
 Required period, in data points, for the indicator to be ready and fully initialized. More...
 

Detailed Description

This indicator creates a moving average (middle band) with an upper band and lower band fixed at k standard deviations above and below the moving average.

Definition at line 22 of file BollingerBands.cs.

Constructor & Destructor Documentation

◆ BollingerBands() [1/2]

QuantConnect.Indicators.BollingerBands.BollingerBands ( int  period,
decimal  k,
MovingAverageType  movingAverageType = MovingAverageType.Simple 
)

Initializes a new instance of the BollingerBands class

Parameters
periodThe period of the standard deviation and moving average (middle band)
kThe number of standard deviations specifying the distance between the middle band and upper or lower bands
movingAverageTypeThe type of moving average to be used

Definition at line 72 of file BollingerBands.cs.

◆ BollingerBands() [2/2]

QuantConnect.Indicators.BollingerBands.BollingerBands ( string  name,
int  period,
decimal  k,
MovingAverageType  movingAverageType = MovingAverageType.Simple 
)

Initializes a new instance of the BollingerBands class

Parameters
nameThe name of this indicator
periodThe period of the standard deviation and moving average (middle band)
kThe number of standard deviations specifying the distance between the middle band and upper or lower bands
movingAverageTypeThe type of moving average to be used

Definition at line 84 of file BollingerBands.cs.

Here is the call graph for this function:

Member Function Documentation

◆ ComputeNextValue()

override decimal QuantConnect.Indicators.BollingerBands.ComputeNextValue ( IndicatorDataPoint  input)
protected

Computes the next value of the following sub-indicators from the given state: StandardDeviation, MiddleBand, UpperBand, LowerBand, BandWidth, B

Parameters
inputThe input given to the indicator
Returns
The input is returned unmodified.

Definition at line 122 of file BollingerBands.cs.

Here is the caller graph for this function:

◆ ValidateAndComputeNextValue()

override IndicatorResult QuantConnect.Indicators.BollingerBands.ValidateAndComputeNextValue ( IndicatorDataPoint  input)
protected

Validate and Compute the next value for this indicator

Parameters
inputInput for this indicator
Returns
IndicatorResult of this update

Override implemented to handle GH issue #4927

Definition at line 137 of file BollingerBands.cs.

Here is the call graph for this function:

◆ Reset()

override void QuantConnect.Indicators.BollingerBands.Reset ( )

Resets this indicator and all sub-indicators (StandardDeviation, LowerBand, MiddleBand, UpperBand, BandWidth, B)

Definition at line 153 of file BollingerBands.cs.

Here is the call graph for this function:

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.BollingerBands.IsReady => MiddleBand.IsReady && UpperBand.IsReady && LowerBand.IsReady && BandWidth.IsReady && PercentB.IsReady

Gets a flag indicating when this indicator is ready and fully initialized

Definition at line 109 of file BollingerBands.cs.

Property Documentation

◆ MovingAverageType

MovingAverageType QuantConnect.Indicators.BollingerBands.MovingAverageType
get

Gets the type of moving average

Definition at line 27 of file BollingerBands.cs.

◆ StandardDeviation

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.StandardDeviation
get

Gets the standard deviation

Definition at line 32 of file BollingerBands.cs.

◆ MiddleBand

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.MiddleBand
get

Gets the middle Bollinger band (moving average)

Definition at line 37 of file BollingerBands.cs.

◆ UpperBand

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.UpperBand
get

Gets the upper Bollinger band (middleBand + k * stdDev)

Definition at line 42 of file BollingerBands.cs.

◆ LowerBand

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.LowerBand
get

Gets the lower Bollinger band (middleBand - k * stdDev)

Definition at line 47 of file BollingerBands.cs.

◆ BandWidth

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.BandWidth
get

Gets the Bollinger BandWidth indicator BandWidth = ((Upper Band - Lower Band) / Middle Band) * 100

Definition at line 53 of file BollingerBands.cs.

◆ PercentB

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.PercentB
get

Gets the Bollinger B B = (Price - Lower Band)/(Upper Band - Lower Band)

Definition at line 59 of file BollingerBands.cs.

◆ Price

IndicatorBase<IndicatorDataPoint> QuantConnect.Indicators.BollingerBands.Price
get

Gets the Price level

Definition at line 64 of file BollingerBands.cs.

◆ WarmUpPeriod

int QuantConnect.Indicators.BollingerBands.WarmUpPeriod
get

Required period, in data points, for the indicator to be ready and fully initialized.

Definition at line 114 of file BollingerBands.cs.


The documentation for this class was generated from the following file: