Blog / Strategy
Strategy

Imbalance Inversion Retest

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 Inversion Retest strategy is a pure price-action, trend-continuation system built around the fair-value gap (FVG) — also called an imbalance — and what happens when that gap fails. A fair-value gap is a three-candle pattern where a fast middle candle moves so quickly that it leaves an "untraded void" between the wick of the first candle and the wick of the third. Many traders treat that void as a support or resistance zone that should hold. This strategy does the opposite: it waits for the void to break and then trades with the breaking move.

Critically, this approach uses no technical indicators. There are no moving averages, no RSI, no MACD — every level, filter, stop, and target is measured directly from raw candle highs and lows. The single "average" in the code is a plain mean candle range, calculated inline only to scale the strategy's thresholds to current volatility. In other words, it reads order flow through candle geometry alone, which makes it a clean teaching tool for understanding imbalance theory and displacement without the distraction of lagging indicators.

This is a momentum continuation strategy, designed with FX majors and gold (XAU) on the M15–H1 timeframes in mind, though it is not locked to any single timeframe. It is best suited to learners who already understand basic candlestick structure and want to study how "smart money" concepts like fair-value gaps, displacement, and inverted zones can be expressed as fully mechanical rules. It is framed here as a strategy analysis — a way to learn how the logic fits together — not as a profit opportunity.

How It Works

The strategy runs a small pipeline once per closed candle. Each step is pure candle geometry. Here is the logic in plain English:

fair value gap inversion strategy
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
MinGapFactor 0.25 0.05 1.50 Minimum fair-value gap size as a fraction of the average candle range. Higher values demand larger, more significant gaps.
RangeLookback 20 10 60 Number of bars used to compute the mean candle range that scales all thresholds to volatility.
DisplacementBodyPct 0.55 0.30 0.90 Minimum body-to-range ratio for a candle to qualify as a displacement (break) candle. Higher values require more decisive moves.
FvgExpiry 18 3 60 Maximum number of bars a fresh gap may wait to invert before it is discarded.
RetestExpiry 14 2 50 Maximum number of bars an inverted zone waits for its equilibrium retest before expiring.
StopBufferFactor 0.25 0.00 1.50 Stop-loss buffer beyond the zone, as a fraction of the average candle range.
RiskReward 2.0 1.0 6.0 Fixed reward-to-risk ratio used to place the take-profit target.
Lots 0.10 0.01 1.00 Trade volume in lots. Should be adjusted to your account size and risk tolerance.
fair value gap inversion strategy — MQL5 source code

Recommended Chart Settings

The Imbalance Inversion Retest strategy was tuned with FX majors (such as EUR/USD, GBP/USD) and gold (XAU/USD) in mind, on the M15 to H1 timeframes. These timeframes tend to produce fair-value gaps that are large enough to be meaningful while still occurring frequently enough to study. That said, the logic is deliberately not locked to any timeframe — it runs on whatever primary timeframe the chart provides.

Remember that results will vary significantly across different instruments, brokers, and market conditions. A setting that behaves well on one pair during a trending phase may behave very differently during a ranging or low-volatility phase. Always test on the specific symbol and timeframe you intend to study before drawing any conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of this approach. Because the strategy is pure price action, it is transparent and easy to reason about — every decision traces back to a candle high or low you can see on the chart. The displacement gate is a thoughtful filter: by requiring a strong-bodied candle to close through a gap, it ignores weak, drifting breaks and focuses on moments that historically reflect genuine order-flow shifts. The equilibrium retest also offers a structured, repeatable entry rather than chasing price, and the fixed reward-to-risk target enforces discipline on exits.

Known limitations. Fair-value gap and inversion concepts are popular, but they are interpretive — there is no universal definition, and this strategy's mechanical rules are one specific interpretation. Continuation trades can suffer in choppy, range-bound markets where gaps form and fail repeatedly without follow-through, producing a series of small losing trades. The fixed-R target means the strategy does not adapt its exit to changing momentum, so it may give back open profit on a target that never fills, or exit before a larger move completes. Slippage and spread — especially on gold — can also affect the precise fill at the equilibrium line.

Conditions where it may underperform. Low-volatility sessions, news-driven whipsaws, and tightly ranging markets are the classic challenges for any continuation system. The strategy may indicate signals that historically would have worked in a trend but struggle when no trend is present. Treat it as a framework for study, and observe how it behaves across many different market regimes before forming any view.

Risk Management Tips

Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any strategy:

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