Bollinger Bands with Squeeze. Adjustable consolidation lines.Core Purpose
This is a Bollinger Bands indicator with squeeze detection and consolidation zone identification - it helps you spot low volatility periods that often precede big price moves.
Main Components:
1. Bollinger Bands (The Foundation)
Basis Line: Moving average (SMA/EMA/etc.) of price - shows the trend
Upper/Lower Bands: Calculated as basis ± (2 × standard deviation)
When bands are wide = high volatility
When bands are narrow = low volatility
2. Squeeze Detection (Yellow highlights)
pinenormalizedWidth = (bbWidth - lowestWidth) / widthRange
inSqueeze = normalizedWidth < squeezeThreshold
Monitors how tight the BB bands are compared to recent history
When bands get extremely narrow (< 2% threshold), it flags a squeeze
Visual cues during squeeze:
Basis turns yellow
Bands turn orange
Background gets yellow tint
Yellow dot appears at top of chart
Trading significance: Squeezes often precede explosive breakouts - low volatility builds pressure
3. Consolidation Detection (Green lines)
pineconsRange = (consHigh - consLow) / close
isConsolidating = consRange < consRangeThreshold
Looks back 10 bars and checks if price is trapped in a tight range
If the high-to-low range is < 1.5% of current price = consolidation
Draws green horizontal lines at the consolidation high and low
Lines persist for 5 bars after breakout
Trading significance: These become support/resistance levels - great for entries on breakouts
How It Works Together:
Squeeze forms - Bands narrow, colors change to yellow/orange
Consolidation detected - Green lines mark the trading range
Breakout happens - Price breaks above/below green lines with momentum
You trade the direction of the breakout with clearly defined levels
Customizable Settings:
Bollinger Bands:
Length (20), source (close), standard deviation multiplier (2.0)
All colors for normal vs squeeze states
Squeeze:
Threshold (0.02) - lower = tighter squeeze required
Consolidation:
Lookback period (10 bars)
Range threshold (0.015 = 1.5%)
Line color
What This Gives You:
Early warning system for volatility breakouts
Clear support/resistance levels from consolidation zones
Visual confirmation when conditions align (squeeze + consolidation = prime setup)
Works on any timeframe - especially powerful when higher TF shows consolidation for lower TF entries
This is essentially a breakout trading system that combines volatility compression (squeeze) with range identification (consolidation) to help you catch explosive moves with defined risk levels.
Pine Script® Indikator






















