Introduction
Automation Platform
Botmain DAO
Building Trading Strategies
API References Dev Live Stream
@botmain/indicators / Class

BollingerBands

Bollinger Bands consist of three lines that form a dynamic envelope around the price chart, useful for identifying market volatility and potential price breakouts or breakdowns.

  • The middle band is a simple moving average (SMA) that is typically set to 20 periods.
  • The upper and lower bands are calculated based on the standard deviation of the price from the SMA, typically set to 2 standard deviations away.

Bollinger Bands are indicators of overbought or oversold conditions:

  • When the price is near the upper band, it might be considered overbought, and a reversal could be forthcoming.
  • When the price is close to the lower band, it might be oversold, indicating a possible reversal to the upside.
  • The middle band often acts as a support or resistance level.

The typical price (TP) and bands are calculated as follows:

TP = (High + Low + Close) / 3
MidBand = SMA(TP, Period)
UpperBand = MidBand + (F * StdDev(TP))
LowerBand = MidBand - (F * StdDev(TP))

F is the multiplication factor applied to the standard deviation, usually set to 2 for the creation of the bands. When the price moves from the lower band and crosses the middle band, the upper band can be used as a target price, and vice versa.

Constructor

Default values period = 14, factor = 2.0

Presentation
constructor(
	
): BollingerBands;

Properties

NameTypeDescription
historyCapacity
inherited from BaseIndicator
number

The maximum history held by the indicator. As new data comes in only this many points are kept.

historyCount
inherited from BaseIndicator
number

The number of historical points currently held by the indicator. Will never be larger than historyCapacity.

last
inherited from BaseIndicator
T
values
inherited from BaseIndicator
T[]

Methods

add()

inherited from BaseSeriesIndicator
No documentation has been provided.
Presentation
add(value: number): void;
Parameters
NameTypeDescription
value
number

Adds the latest value (usually price) to the indicator. Normally called for each indicator in onBarClose()

Returns

void