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 Fvg Inversion Reversal is a pure price-action reversal strategy built around the inversion of a fair-value gap (often abbreviated IFVG in Smart-Money-Concepts trading), and it uses no traditional technical indicators at all. A fair-value gap, or FVG, is a three-candle imbalance: a fast middle candle moves so quickly that it leaves an "untraded void" on the chart. For a bullish gap, the high of the first candle sits below the low of the third candle, leaving a vertical pocket of price that was skipped over. The Fvg Inversion Reversal watches these gaps and trades a very specific outcome — the moment a gap fails.
Most fair-value-gap systems treat the gap as support or resistance that should hold, expecting price to bounce off it and continue. This strategy is the mirror image. It waits for price to close decisively through a fresh gap, which invalidates the imbalance and "inverts" it: a broken bullish gap is reinterpreted as fresh supply (a selling zone), while a broken bearish gap becomes fresh demand (a buying zone). The strategy then trades the first retest of that inverted void as a counter-trend reversal, against the side that just failed.
As a learning tool, the Fvg Inversion Reversal is well suited to traders who want to study Smart-Money-Concepts ideas — imbalance, invalidation, and order-flow shifts — expressed in clean, transparent candle geometry. It was designed with FX majors and gold (XAU) on the M15 to H1 timeframes in mind, but it is not locked to any single timeframe. Because it is a counter-trend reversal approach, it is best understood as an educational study of how failed structures can flip rather than as a signal to chase profits.
How It Works
The strategy runs as two small, independent state machines — one for bullish gaps and one for bearish gaps — and acts only on fully closed candles. Each side moves through three states: inactive, a fresh gap awaiting a violation, and an inverted zone awaiting its first retest.
- Volatility filter (gap size): On every closed bar, the strategy measures the average candle range over a recent lookback window (plain mean of high-minus-low). The minimum acceptable gap is set to a fraction of that average, so the gap filter automatically scales to current volatility.
- Detecting a fresh gap: The strategy inspects the last three closed candles. A bullish FVG exists when the oldest candle's high is below the newest candle's low, the middle candle is bullish, and the gap is at least the minimum size. A bearish FVG is the mirror — the oldest low is above the newest high with a bearish middle candle.
- The inversion trigger: A bullish gap is considered broken when a candle closes below the bottom edge of the gap. At that point the gap inverts into a supply (sell) zone. A bearish gap inverts into a demand (buy) zone when a candle closes above its top edge.
- Sell entry signal: Once a bullish gap has inverted into a supply zone, the strategy waits for price to rally back up into the void and then close back under the zone's top. When the candle's high reaches into the zone but its close finishes at or below the top edge, the strategy signals a reversal short.
- Buy entry signal: Once a bearish gap has inverted into a demand zone, the strategy waits for price to dip back down into the void and close back above the zone's base. When the candle's low reaches into the zone but the close finishes at or above the base, the strategy signals a reversal long.
- Stop-loss logic: For a short, the stop is placed just above the zone's top, padded by a buffer expressed as a fraction of the zone's height. For a long, the stop sits just below the zone's base with the same buffer. The stop is therefore anchored to structure, not a fixed pip distance.
- Take-profit logic: The target uses a fixed reward-to-risk multiple. The distance from entry to stop defines one unit of risk, and the take-profit is placed that many multiples away in the direction of the trade.
- Expiry and housekeeping: A fresh gap that never gets violated is dropped after a set number of bars. An inverted zone that is never retested — or that gets fully reclaimed by price closing back through it — is also discarded. The strategy holds only one position at a time per magic number.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| MinGapFactor | 0.20 | 0.05 | 1.50 | Minimum gap size as a fraction of the mean candle range. Higher values demand larger, more significant imbalances. |
| RangeLookback | 20 | 10 | 60 | Number of recent bars used to compute the mean candle range that scales the gap filter. |
| FvgExpiry | 15 | 3 | 60 | Maximum bars a fresh fair-value gap may wait for a violation before it is discarded. |
| RetestExpiry | 12 | 2 | 50 | Maximum bars an inverted zone waits for its first retest before it is dropped. |
| RiskReward | 2.0 | 1.0 | 6.0 | Fixed reward-to-risk multiple used to set the take-profit relative to the stop distance. |
| ZoneBufferPct | 0.15 | 0.00 | 1.00 | Stop-loss buffer beyond the zone, expressed as a fraction of the zone's height. |
| Lots | 0.10 | 0.01 | 1.00 | Fixed lot size used for each order. |

Recommended Chart Settings
The Fvg Inversion Reversal was tuned with FX majors and gold (XAU) on the M15 to H1 timeframes in mind, where intraday imbalances form and resolve frequently enough to give the state machines plenty of setups to track. That said, the logic is deliberately locked to no fixed timeframe — it runs on whatever primary timeframe you attach it to. You are encouraged to study its behavior across several symbols and timeframes, because gap frequency, average range, and the way price retests inverted zones will differ from market to market. Results will vary across different market conditions, sessions, and instruments, so treat any single configuration as a starting point for your own analysis rather than a finished setting.
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
A genuine strength of the Fvg Inversion Reversal is its transparency. Every decision comes from raw highs and lows — there are no smoothed indicators, no hidden lag, and no curve-fit signal lines. The stop is structural, sitting just beyond the zone that defined the trade, and the target is a clean fixed-R multiple, which makes the risk profile easy to reason about. For students of Smart-Money-Concepts, the strategy is a clear, readable example of how an imbalance can be invalidated and flipped.
It is also important to be honest about the limitations of this style. Counter-trend reversal trading is inherently challenging: the strategy deliberately sells strength and buys weakness, so in a strong, persistent trend a failed gap may simply keep failing in the trend's direction, producing a run of losing retests. Because entries depend on a precise sequence — gap forms, gap is violated by a close, price retests within a limited window — the strategy can sit idle for long stretches, and the expiry filters will discard many setups that never complete. Choppy or low-volatility conditions can also generate gaps that are too small to pass the filter, or zones that get reclaimed before a clean retest. None of these behaviors are flaws to be fixed; they are characteristics to understand through testing.
Risk Management Tips
- Use a demo account first. Run the Fvg Inversion Reversal on a demo for an extended period so you can observe how it behaves across trending, ranging, and high-volatility conditions before committing real capital.
- Risk a small, fixed fraction per trade. A common educational guideline is to risk no more than 1–2% of account equity on any single position. Because this EA uses a fixed lot size, consider how that lot size relates to your account and the structural stop distance on your chosen symbol.
- Understand drawdown. Reversal strategies can experience clusters of consecutive losses. Study the worst-case sequences in testing so you are mentally and financially prepared for them.
- Size positions deliberately. Match your lot size to your account balance, the instrument's volatility, and your personal risk tolerance — not to a desire to recover a previous loss.
- Keep the bigger picture in view. Even a well-defined setup benefits from awareness of higher-timeframe trend and major news events, which can overwhelm short-term gap structure.
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: FvgInversionReversal.ex5 (0 downloads)
- Source Code: FvgInversionReversal.mq5 (0 downloads)
- Documentation: FvgInversionReversal.pdf (0 downloads)