Bollinger Squeeze Detector
Bollinger Band width tends to contract before a large move and expand during one, which is why traders watch for a "squeeze" - bands pulling in tight - as an early warning that a breakout may be building. The naive way to detect that is to compare width against a fixed number, which breaks the moment the indicator is dropped onto a different symbol or timeframe with a different typical width. This indicator instead ranks the current relative band width against the last InpLookback readings on the same symbol and timeframe, producing a 0-100 percentile that means the same thing everywhere: a reading of 10 always means "unusually tight for this instrument right now", never a number calibrated to one particular pair. Because MQL4 indicators have no colour-changing line primitive, a squeeze reading is shown by switching which of two buffers is active on a given bar rather than by changing a single line's colour property - the standard workaround for that platform limitation. This is a single-band method: it judges volatility from Bollinger width alone. BbKcSqueeze, elsewhere in this collection, uses a stricter dual-band definition that also checks the bands against a Keltner Channel; the two are complementary rather than duplicates, and comparing their readings is often more informative than either alone. Notes and limitations - Needs InpBandsPeriod + InpLookback + 1 bars of history before the first reading appears; earlier bars are intentionally left empty. - Each bar's percentile is derived fresh from the platform's own Bollinger Band history rather than tracked incrementally, so it cannot repaint once a bar closes. - A squeeze reading says only that recent range has compressed - it gives no information about which direction the eventual breakout will favour. Pair it with a directional or momentum tool for entries. - A single-band method; it does not check price against a Keltner Channel the way BbKcSqueeze does, so the two can disagree during ambiguous volatility conditions.
Indicator · MT4 · v1.0 · Free
About Bollinger Squeeze Detector
Bollinger Squeeze Detector is an indicator for MetaTrader 4 based on Bollinger Bands. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Bands period, Bands deviation and Lookback. MQL source code included.
Files in the download: BollingerSqueeze.ex4, BollingerSqueeze.mq4, BollingerSqueeze.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Bands period | 20 | Bollinger Bands period |
| Bands deviation | 2.0 | Bollinger Bands standard deviation multiplier |
| Lookback | 200 | Bars of width history the current width is ranked against |
| Squeeze level | 20.0 | Percentile at or below which the market is judged squeezed |
| Alerts | true | Alert once when a squeeze condition begins |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Breakout · Bollinger Bands · Trailing Stop & Break-even · Alerts · MT4 Indicator · MQL4 Source Code