Skip to main content

Bollinger Bands

Bollinger Bands consist of a middle band (SMA) with upper and lower bands based on standard deviations.

Registration Name: "BOLLINGER"

Parameters:

  • period (required): Period for the middle band SMA
  • field (required): Price field to use
  • multiplier (optional): Number of standard deviations for bands (default: 2)

Returns: Three components accessible via different methods:

  • getValue(): Middle band (SMA)
  • getBands(): Object containing all three bands:
    • middle: SMA value
    • upper: Upper band (SMA + multiplier * StdDev)
    • lower: Lower band (SMA - multiplier * StdDev)
registerIndicator("BOLLINGER", "BUILTIN", {
period: 20,
field: "close",
multiplier: 2
}, "BB_20_CLOSE"); // Custom ID for this instance