Skip to content
FXNook HubBeta

Alex / Squeeze Momentum Indicator for MT4

MetaTrader 4IndicatorMITCompiled · build 2425
AlexFirst version.build 2425v1.01 day ago1 version
  • FXN_SqueezeMomentum.mq4First version.10 KB
  • FXN_SqueezeMomentum.ex4Compiled by the Lab with MetaEditor build 242524 KB
README

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 length plus and minus BB deviations x standard deviation.
  • Keltner Channel: SMA of close over KC length plus and minus KC width x 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)) / 2 over KC length bars. The histogram is the end value of a least-squares regression line through the last Momentum length values of x.
  • Histogram colours: above zero and rising, above zero and falling, below zero and falling, below zero and rising.

Inputs

InputDefaultWhat it does
BB length / deviations20 / 2.0Bollinger Bands settings
KC length / width20 / 1.5Keltner Channel settings
True rangetrueKeltner range uses true range (false = high - low)
Momentum length20Regression length of the momentum
Four histogram coloursLime / Green / Red / MaroonRising and falling above and below zero
Squeeze on / off / neitherOrangeRed / LimeGreen / DimGrayDot colours
Alert when squeeze endsfalseOne alert when a closed bar ends a squeeze

How to use it

  1. In MetaTrader open File > Open Data Folder.
  2. MT4: copy FXN_SqueezeMomentum.mq4 into MQL4/Indicators. MT5: copy FXN_SqueezeMomentum.mq5 into MQL5/Indicators.
  3. 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.
  4. 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

InputTypeDefaultNote
InpSep1string=== Squeeze ===---- Squeeze ----
InpBBLengthint20Bollinger Bands length
InpBBMultdouble2.0Bollinger Bands deviations
InpKCLengthint20Keltner Channel length
InpKCMultdouble1.5Keltner Channel width (x average range)
InpTrueRangebooltrueKeltner range: true range (false = high - low)
InpSep2string=== Momentum ===---- Momentum ----
InpMomLengthint20Linear regression length of the momentum
InpSep3string=== Colours ===---- Colours ----
InpUpRisingcolorclrLimeMomentum above zero and rising
InpUpFallingcolorclrGreenMomentum above zero and falling
InpDownFallingcolorclrRedMomentum below zero and falling
InpDownRisingcolorclrMaroonMomentum below zero and rising
InpSqzOncolorclrOrangeRedDot: squeeze on (bands inside the channel)
InpSqzOffcolorclrLimeGreenDot: squeeze off (bands outside the channel)
InpNoSqzcolorclrDimGrayDot: neither
InpSep4string=== Alerts ===---- Alerts ----
InpAlertFireboolfalseAlert once when a closed bar ends a squeeze

How to use it

  1. Download the compiled file (or the source and compile it in MetaEditor).
  2. Put it in MetaTrader: File → Open Data Folder → MQL4 → Indicators, then refresh the Navigator.
  3. Test it on a demo account before any real money.
  4. Want changes? Open a copy in your Lab and ask for them in plain words.