Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Volatility Squeeze Momentum Shift strategy is an automated MetaTrader 5 Expert Advisor (EA) built around a volatility squeeze — a market condition where price compresses into an unusually tight range before it expands. Its core engine blends two well-known volatility tools: Bollinger Bands (a moving average surrounded by standard-deviation bands that widen and narrow with price variability) and a Keltner Channel (a similar envelope built from the Average True Range, or ATR, a measure of how far price typically travels per bar). When the Bollinger Bands contract entirely inside the Keltner Channel, the market is considered "in the squeeze" — coiled and storing energy. This is a classic momentum-breakout trading style rebuilt from first principles.
The strategy is designed for markets that alternate between quiet, range-bound phases and sharp directional bursts. Rather than trying to trade the chop, it waits patiently while volatility is compressed and then acts on the release — the moment the squeeze ends and price is statistically more likely to expand. To decide which direction to trade that release, it uses a momentum oscillator modeled on the TTM momentum base, plus a longer trend EMA (Exponential Moving Average) as a confluence filter so it only trades in the direction of the broader trend.
As a learning tool, this EA is well suited to traders who want to study how volatility-compression concepts, multi-indicator confluence, and ATR-based risk management fit together in a single, non-repainting system. It is best treated as a framework for understanding squeeze mechanics — not as a shortcut. Every reader should approach it as a strategy analysis exercise, testing and observing its behavior on historical and demo data before drawing any conclusions.
How It Works
The strategy evaluates the market once per bar, always acting on the just-completed candle (never the still-forming one). This makes it non-repainting — signals do not change after the fact. Here is the logic in plain English:
- Squeeze detection (compression): On every closed bar, the strategy computes a Bollinger Band and a Keltner Channel that share the same moving-average basis. The squeeze is considered ON when the upper Bollinger Band sits below the upper Keltner line and the lower Bollinger Band sits above the lower Keltner line — i.e. the Bollinger Bands are fully inside the channel. It counts how many consecutive bars the squeeze has lasted.
- Release trigger (expansion): The actual entry signal fires on the bar where the squeeze turns OFF after having been ON for at least
MinSqueezeBarsconsecutive bars. A longer squeeze that finally releases has historically tended to expand more forcefully, which is why a minimum duration is required. - Direction — momentum: A momentum oscillator (close price minus the average of the Donchian midline and a short SMA) determines the side. The strategy signals a long when momentum is above zero and rising, and a short when momentum is below zero and falling.
- Direction — trend filter: A trend EMA acts as an extra gate. Longs are only permitted when the completed close is above the EMA; shorts only when it is below. This is designed to cut counter-trend false signals.
- Spread guard: Before entering, the strategy checks that the current spread is within
MaxSpreadPoints, helping avoid poor fills during illiquid conditions. - Stop-loss logic: On entry, the stop is placed at
SlAtrMult × ATRaway from the fill price — a volatility-scaled stop that automatically widens in fast markets and tightens in calm ones. - Take-profit logic: The target is placed at
TpAtrMult × ATRfrom entry. The resulting reward-to-risk ratio is simplyTpAtrMult ÷ SlAtrMult(3.0 ÷ 2.0 = 1.5 at the defaults). - Trailing stop: Once a trade is open, an ATR-based trailing stop (
TrailAtrMult × ATR) follows price but only ever tightens, never loosens — locking in open profit as a move extends. SettingTrailAtrMultto 0 disables trailing entirely. - One position at a time: The EA holds only a single position per magic number, managing the existing trade rather than stacking new ones.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| BbPeriod | 20 | 10 | 40 | Length of the shared SMA basis for both the Bollinger Band and Keltner Channel. |
| BbMult | 2.0 | 1.5 | 3.0 | Bollinger Band standard-deviation multiplier (controls band width). |
| KcMult | 1.5 | 1.0 | 2.5 | Keltner Channel ATR multiplier. The squeeze is defined by the Bollinger Bands sitting inside this channel. |
| MomentumPeriod | 12 | 6 | 30 | Lookback length for the momentum oscillator that sets trade direction. |
| AtrPeriod | 14 | 7 | 30 | ATR period used for the Keltner width, stops, target, and trailing stop. |
| SlAtrMult | 2.0 | 1.0 | 4.0 | Stop-loss distance as a multiple of ATR. |
| TpAtrMult | 3.0 | 1.0 | 6.0 | Take-profit distance as a multiple of ATR (reward:risk = TpAtrMult ÷ SlAtrMult). |
| TrailAtrMult | 2.0 | 0.0 | 5.0 | Trailing-stop distance as a multiple of ATR. Set to 0 to disable trailing. |
| TrendEmaPeriod | 50 | 20 | 200 | Trend-filter EMA length. Longs only above it, shorts only below it. |
| MinSqueezeBars | 6 | 1 | 20 | Minimum consecutive squeeze bars required before a release is traded. |
| RiskPercent | 1.0 | 0.1 | 3.0 | Fraction of account balance risked per trade (fixed-fractional sizing). |
(Additional money-management inputs — fallback fixed lot, a hard maximum-lot clamp, contract size, spread guard, and magic number — are read from the EA but are not part of the optimizable set above.)

Recommended Chart Settings
This strategy is timeframe-agnostic by design: every calculation uses the primary chart timeframe, so it runs on whatever timeframe you attach it to. Because it depends on volatility compression and expansion cycles, many traders study squeeze systems on intraday charts such as the M15, M30, or H1, and on liquid instruments like major forex pairs (for example EUR/USD) where spreads are tight and ATR behavior is well-defined.
There is no single "correct" symbol or timeframe. The volatility characteristics of every market differ, and a setting that behaves one way on one instrument may behave very differently on another. Always remember that results will vary across different market conditions, sessions, and volatility regimes. Use the built-in Strategy Tester to observe how the parameters respond before committing to any configuration.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
Like every approach, the Volatility Squeeze Momentum Shift has both strengths and genuine limitations, and understanding both is the point of studying it.
Strengths of this approach:
- It is selective. By waiting for a compression phase to fully form and then release, it avoids trading in the middle of directionless noise.
- Its risk parameters are volatility-adaptive. ATR-based stops, targets, and trailing all scale with current market conditions rather than using fixed pip distances.
- The multi-layer confluence (squeeze + momentum + trend EMA) is designed to filter out many low-quality signals.
- It is non-repainting, so what you see in the tester reflects how it evaluates live bars.
Known limitations and where it may underperform:
- False releases are inevitable. Not every squeeze that ends leads to a clean expansion; some resolve sideways or immediately reverse, producing losing trades.
- Choppy, low-volatility ranges can generate a string of small losses as the market fakes breakouts in both directions.
- Whipsaws around the trend EMA may cause the filter to block otherwise valid moves, or to allow late entries after much of the move has already occurred.
- Reward:risk is not win rate. With the default 1.5 reward-to-risk ratio, the strategy does not need to win most trades — but that also means it can experience clusters of losing trades during unfavorable regimes.
- No system works in all markets. Volatility-breakout logic tends to struggle in persistently quiet or mean-reverting conditions.
The honest takeaway is that this EA is a structured framework for studying squeeze breakouts, not a finished solution. Its behavior will change meaningfully with different parameters, symbols, and timeframes, and thorough testing is essential.
Risk Management Tips
Sound risk management matters far more than any single indicator setting. As you study this strategy, keep these general principles in mind:
- Risk a small, fixed fraction per trade. A common educational guideline is to risk no more than 1–2% of account balance on any single position. The EA's
RiskPercentinput defaults to 1.0 for this reason. - Size positions from your stop, not your hopes. Fixed-fractional sizing ties lot size to the ATR-based stop distance, so a wider stop automatically means a smaller position.
- Always start on a demo account. Run the EA in the Strategy Tester and on a demo account across different market conditions before considering any real capital.
- Understand drawdown. Every strategy endures losing streaks. Know the maximum peak-to-trough decline you are willing to tolerate, and study how the system behaves during its worst historical stretches.
- Never over-leverage. Larger position sizes amplify both gains and losses; leverage should be treated with caution.
- Keep records and review. Journaling your tests and observations turns raw results into genuine understanding.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: VolatilitySqueezeMomentumShift.ex5 (0 downloads)
- Source Code: VolatilitySqueezeMomentumShift.mq5 (0 downloads)
- Documentation: VolatilitySqueezeMomentumShift.pdf (0 downloads)