Blog / Strategy
Strategy

Imbalance Magnet Reversal

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 Imbalance Magnet Reversal is a pure price-action, counter-trend (mean-reversion) strategy that uses two raw chart structures — swing support/resistance levels and Fair Value Gaps (FVGs, also called imbalances) — without relying on a single technical indicator. There is no moving average, RSI, ATR, or Bollinger Band anywhere in its logic. Instead, it reads the geometry of recent candles directly, which makes it a useful study tool for traders who want to understand how structure and liquidity interact on a clean chart.

A swing support or resistance level is a horizontal price where the market previously turned. The strategy confirms these from fractal pivots — a candle whose high tops (or whose low bottoms) every neighboring candle for a set number of bars on both sides. A Fair Value Gap is a three-candle pattern where the middle candle moves so quickly that the first and third candles leave an untraded "pocket" of price behind. In classic Smart Money Concepts theory, the market is often drawn back to fill these voids, so an unfilled gap can act like a magnet for future price movement.

What makes this approach distinctive is that it inverts the usual "trade the gap" playbook. Most FVG systems enter inside the gap. Here, the gap is never the entry — it is only the target. The entry is a clean rejection off a swing level, and the unfilled imbalance becomes the destination the strategy aims for. It was built with EUR/USD or XAU/USD (gold) on the M15 timeframe in mind, and it is best suited to intermediate learners who already grasp candlestick anatomy and want to see how structure-based, no-indicator logic can be coded.

How It Works

The strategy evaluates the market once per freshly closed candle and only ever holds one position at a time. Before any signal is considered, it builds a simple volatility scale by averaging the candle range (high minus low) over the lookback window, so every threshold automatically adapts to the symbol and current conditions without needing the instrument's point size.

Entry conditions — the strategy signals a trade when:

Take-profit logic — the magnet:

Stop-loss logic:

Reward-to-risk filter:

Both the structural stop and the imbalance target manage the exit — there is no separate trailing or time-based close.

Imbalance Magnet Reversal strategy
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Lots 0.10 0.01 1.00 Fixed order volume in lots for each trade.
PivotLeg 3 2 8 Bars required on each side to confirm a fractal swing pivot. Higher values mean stronger, rarer levels.
SrLookback 60 20 200 How many recent closed bars to scan for swing levels and the volatility scale.
TouchZoneFrac 0.15 0.02 1.00 How close (as a fraction of mean candle range) the wick must come to a level to count as a "touch."
GapLookback 40 6 150 How many recent closed bars to scan for an unfilled magnet gap.
MinGapFrac 0.25 0.05 1.50 Minimum gap height as a fraction of mean candle range; rejects noise gaps.
StopBufferFrac 0.15 0.00 1.00 Stop buffer beyond the rejected level or signal-candle extreme, as a fraction of range.
MinRewardRisk 1.00 0.30 5.00 Minimum reward-to-risk ratio to the magnet target; below this the setup is skipped.
MaxSpreadPoints 100 5 300 Skip entries when the spread (in points) is wider than this value.
Magic 7340 0 9,999,999 Unique identifier so the EA only manages its own positions.
Imbalance Magnet Reversal strategy — MQL5 source code

Recommended Chart Settings

This strategy was designed and tuned with EUR/USD or XAU/USD (gold) on the M15 (15-minute) timeframe in mind, but its volatility-scaled thresholds mean it can run on any liquid instrument and timeframe the chart provides — it reads only the primary symbol and timeframe of the chart it is attached to. Because the logic adapts to the average candle range automatically, you do not need to re-tune point-based settings when switching symbols. That said, results will vary considerably across different instruments, sessions, and market conditions, so always validate behavior on each market separately before drawing conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths. Because the Imbalance Magnet Reversal uses no indicators, it avoids the lag and curve-fitting that indicator-based systems can introduce. Its levels are built only from closed bars, so they never repaint — what you see in a backtest is what the logic actually saw in real time. The structured "rejection in, imbalance out" framework also enforces a defined risk and a defined target on every trade, which is a healthy discipline to study.

Known limitations. Counter-trend, mean-reversion systems share a well-documented weakness: in a strong, sustained trend, support and resistance levels break rather than hold, and a strategy that keeps fading those levels can suffer repeated losses. The Fair Value Gap target may also remain unfilled for a long time — or never fill — which can leave trades hanging or missing. The single-position rule means the EA can sit idle while opportunities pass, and the spread filter will block entries entirely during volatile news periods when spreads widen.

Where it may underperform. Expect weaker behavior during low-liquidity hours, around major news releases, and in trending environments where price slices straight through structure. The fractal pivot confirmation also introduces a natural delay — a level is only confirmed after enough bars form on both sides — so the strategy may identify structure later than a discretionary trader would. Treat it as an educational illustration of structure-and-liquidity logic, not a finished trading system.

Risk Management Tips

Sound risk management matters more than any single strategy. Consider these general principles as part of your learning:

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

← Back to Blog