Bollinger Bands (BBANDS)

Indicator Description

Bollinger Bands are a volatility indicator that creates dynamic support and resistance bands by calculating the standard deviation of price. It consists of three lines: the middle band (moving average), the upper band (resistance), and the lower band (support).

Function Information

  • Function Name: BBANDS
  • Input Parameters: #Kline
  • Parameter Settings:
    • timeperiod (default: 5)
    • nbdevup (default: 2.0)
    • nbdevdn (default: 2.0)
    • matype (default: 0)
  • Output: upper (upper band), middle (middle band), lower (lower band)

Calculation Principle

Bollinger Bands are calculated using the following formulas:

middle = MA(Close, timeperiod)
standard deviation = STD(Close, timeperiod)
upper = middle + (nbdevup * standard deviation)
lower = middle - (nbdevdn * standard deviation)

Where:

  • MA is the moving average
  • STD is the standard deviation
  • nbdevup and nbdevdn are the standard deviation multipliers
  • timeperiod is the calculation period

Usage Scenarios

  1. Support and resistance level identification
  2. Volatility analysis
  3. Overbought and oversold judgment
  4. Trend confirmation

Usage Recommendations

  1. Price touching the upper band may indicate overbought
  2. Price touching the lower band may indicate oversold
  3. Bandwidth narrowing may signal a breakout
  4. Use in combination with other indicators
Last Updated: