P
PipsGrowth

Key Takeaways

Difficulty:Beginner
Reliability:High
Category:volatility
Timeframes:15M, 1H, 4H

Bollinger Bands

volatilityšŸ“Š 15M, 1H, 4H, Daily

Consists of a middle band (SMA) and upper/lower bands set at standard deviations from the middle.

Formula

Code
Middle Band = 20-period SMA
Upper Band = Middle Band + (2 Ɨ Standard Deviation)
Lower Band = Middle Band - (2 Ɨ Standard Deviation)

Detailed Explanation

Bollinger Bands, developed by John Bollinger, create dynamic channels around price based on volatility. They consist of three lines:

**Components:** - **Middle Band**: Simple Moving Average (typically 20) - **Upper Band**: Middle + (2 Ɨ Std Dev) - **Lower Band**: Middle - (2 Ɨ Std Dev)

**Key Signals:** - **Squeeze**: Bands contract before breakouts - **Walking the Bands**: Price hugging bands in trends - **Mean Reversion**: Price returning to middle band

Parameters

Period
Default: 20
SMA period
Std Dev
Default: 2
Standard deviation multiplier

šŸ“ˆ Bullish Signals

Price bounces off lower band, squeeze followed by upward breakout

šŸ“‰ Bearish Signals

Price rejected at upper band, squeeze followed by downward breakout

Python Implementation

Bollinger Bands with pandas-ta

Python
import pandas_ta as ta
bb = ta.bbands(df['close'], length=20, std=2)
df['BB_Upper'] = bb['BBU_20_2.0']
df['BB_Middle'] = bb['BBM_20_2.0']
df['BB_Lower'] = bb['BBL_20_2.0']
df['BB_Width'] = bb['BBB_20_2.0']

TradingView Pine Script

JavaScript
//@version=5
indicator("Bollinger Bands", overlay=true)
[middle, upper, lower] = ta.bb(close, 20, 2)
plot(upper, "Upper", color=color.red)
plot(middle, "Middle", color=color.blue)
plot(lower, "Lower", color=color.green)
šŸ“Š Use TradingView for Advanced Charting
Professional analysis tools with 100+ technical indicators
Get TradingView Pro

MT5 MQL5 Code

C++
int bb_handle = iBands(_Symbol, _Period, 20, 0, 2, PRICE_CLOSE);
double upper[], middle[], lower[];
CopyBuffer(bb_handle, 0, 0, 3, middle);
CopyBuffer(bb_handle, 1, 0, 3, upper);
CopyBuffer(bb_handle, 2, 0, 3, lower);

Common Mistakes

āœ—Selling just because price touches upper band
āœ—Ignoring the squeeze as a volatility warning

Confirmation Signals

RSI at extremes
Volume on breakout
Candlestick patterns

Best For

Volatility measurementOverbought/oversoldBreakout identification

šŸ’” Pro Tips

  • •Band squeeze (narrow bands) often precedes strong moves
  • •Price can "walk the band" in strong trends
  • •Use with RSI for confirmation - RSI divergence at bands is powerful
Last updated: December 29, 2024

Educational Disclaimer

This content is for educational purposes only and does not constitute financial or investment advice. Trading involves significant risk and you may lose your capital. Always consult a licensed financial advisor before making investment decisions.

Frequently Asked Questions