Overview
Shows when Bollinger Bands sit inside the Keltner Channel (a volatility squeeze) and plots a linear-regression momentum histogram coloured by direction.
- What it is
- A free Indicator for MetaTrader 4, written in MQL4.
- What it does
- Shows when Bollinger Bands sit inside the Keltner Channel (a volatility squeeze) and plots a linear-regression momentum histogram coloured by direction.
- Shared by
- Alex
- Licence
- MIT
- Version
- 1.0 (1 Dec 2026)
- Settings
- 18 inputs
- Lab check
- Compiled with MetaEditor build 2425 for MT4 on 1 Dec 2026: 0 errors, 0 warnings.
- Price
- Free to download
Markets alternate between quiet, tight periods and strong moves. This indicator shows when volatility is compressed (a squeeze) and which way momentum is pointing, so you can prepare for the move that often follows a squeeze instead of chasing it.
How it works
- Bollinger Bands: SMA of close over
BB lengthplus and minusBB deviationsx standard deviation. - Keltner Channel: SMA of close over
KC lengthplus and minusKC widthx the average range (true range, or high minus low). - Squeeze on (first dot colour) when both Bollinger Bands are inside the Keltner Channel. Squeeze off (second colour) when both are outside. Grey when neither.
- Momentum: for each bar,
x = close - ((highest high + lowest low) / 2 + SMA(close)) / 2overKC lengthbars. The histogram is the end value of a least-squares regression line through the lastMomentum lengthvalues of x. - Histogram colours: above zero and rising, above zero and falling, below zero and falling, below zero and rising.
Inputs
| Input | Default | What it does |
|---|---|---|
| BB length / deviations | 20 / 2.0 | Bollinger Bands settings |
| KC length / width | 20 / 1.5 | Keltner Channel settings |
| True range | true | Keltner range uses true range (false = high - low) |
| Momentum length | 20 | Regression length of the momentum |
| Four histogram colours | Lime / Green / Red / Maroon | Rising and falling above and below zero |
| Squeeze on / off / neither | OrangeRed / LimeGreen / DimGray | Dot colours |
| Alert when squeeze ends | false | One alert when a closed bar ends a squeeze |
How to use it
- In MetaTrader open File > Open Data Folder.
- MT4: copy
FXN_SqueezeMomentum.mq4intoMQL4/Indicators. MT5: copyFXN_SqueezeMomentum.mq5intoMQL5/Indicators. - Right-click Indicators in the Navigator and choose Refresh (or restart the terminal). The file compiles on first use; you can also open it in MetaEditor and press Compile.
- Drag the indicator onto a chart and set the inputs.
The defaults (20 / 2.0 / 20 / 1.5) are the classic settings and work on most symbols from M15 to D1. A common reading: wait for a run of squeeze-on dots, then watch the first bar after the squeeze ends; the side of zero the histogram is on and whether it is rising gives the likely direction. Pair it with a trend filter or support and resistance.
Good to know
- The values on the forming bar change with price, like any oscillator. Dots and colours on closed bars are fixed. The alert only looks at closed bars.
- A squeeze can end with a false start; momentum can flip soon after.
- The histogram is in price units, so its size differs between symbols.
- It is a visual tool and does not trade.
Trading carries risk. Test on a demo account first; past results do not predict future results.
Settings read from the code
| Input | Type | Default | Note |
|---|---|---|---|
| InpSep1 | string | === Squeeze === | ---- Squeeze ---- |
| InpBBLength | int | 20 | Bollinger Bands length |
| InpBBMult | double | 2.0 | Bollinger Bands deviations |
| InpKCLength | int | 20 | Keltner Channel length |
| InpKCMult | double | 1.5 | Keltner Channel width (x average range) |
| InpTrueRange | bool | true | Keltner range: true range (false = high - low) |
| InpSep2 | string | === Momentum === | ---- Momentum ---- |
| InpMomLength | int | 20 | Linear regression length of the momentum |
| InpSep3 | string | === Colours === | ---- Colours ---- |
| InpUpRising | color | clrLime | Momentum above zero and rising |
| InpUpFalling | color | clrGreen | Momentum above zero and falling |
| InpDownFalling | color | clrRed | Momentum below zero and falling |
| InpDownRising | color | clrMaroon | Momentum below zero and rising |
| InpSqzOn | color | clrOrangeRed | Dot: squeeze on (bands inside the channel) |
| InpSqzOff | color | clrLimeGreen | Dot: squeeze off (bands outside the channel) |
| InpNoSqz | color | clrDimGray | Dot: neither |
| InpSep4 | string | === Alerts === | ---- Alerts ---- |
| InpAlertFire | bool | false | Alert once when a closed bar ends a squeeze |
How to use it
- Download the compiled file (or the source and compile it in MetaEditor).
- Put it in MetaTrader: File → Open Data Folder → MQL4 → Indicators, then refresh the Navigator.
- Test it on a demo account before any real money.
- Want changes? Open a copy in your Lab and ask for them in plain words.