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?
Opening Balance Reversion is an intraday, time-anchored mean-reversion strategy that fades failed breakouts of the session's opening range using an Average True Range (ATR) volatility filter. The core idea comes from auction market theory: during the first part of a trading session, the market discovers an initial "value area" — a high and a low that together form what traders call the opening balance. The midpoint of that balance tends to act as a magnet for the rest of the session, so when price pokes above or below an edge and is then rejected back inside, the strategy signals a fade back toward the centre.
The strategy is built for range-bound or balanced intraday conditions — the sort of quieter, two-sided session where price probes the extremes of the early range and then reverts, rather than trending away in one direction all day. To avoid fighting genuine trend days, it uses an ATR-based "runaway" filter: if a poke beyond the edge is larger than a configurable multiple of ATR (a measure of recent volatility, or how far price typically moves per bar), the setup is ignored entirely. This is a deliberate attempt to stay out of the market when the auction is not balanced.
As a learning tool, Opening Balance Reversion is well suited to traders who want to study session-based mean reversion, opening-range concepts, and volatility-normalized risk placement. It demonstrates how a systematic strategy can encode ideas like time-of-day anchoring, rejection candles, and break-even trailing into precise, repeatable rules. It is not a shortcut of any kind — it is a structured example of how one style of intraday logic can be expressed in code and studied on historical data.
How It Works
The strategy operates on completed bars only (no repainting) and manages one position at a time. Here is the full logic in plain English:
Session anchoring and the opening balance
- At the start of each new day, once the clock reaches
SessionStartHour(UTC), a fresh session begins and any positions from a previous session are flattened — there is no overnight carry. - The strategy then measures the highest high and lowest low of the first
OpeningRangeBarsbars. Together these form the opening balance box, and their average defines the midpoint. - Once the box is complete, the strategy begins looking for fade setups until
SessionEndHour, when it stops trading and closes any open position.
Entry conditions (short — fading the top)
The strategy signals a short when all of the following are true:
- The just-closed bar's high reached or exceeded the opening-balance high (a poke above the edge).
- That poke was no larger than
MaxPokeAtrMult× ATR beyond the edge — a bigger break is treated as a possible trend day and ignored. - The bar closed back inside the balance (below the opening-balance high).
- The bar was bearish (closed below its open) — a rejection candle.
- The balance width is at least
MinRangeAtrMult× ATR, so the range is wide enough to be worth fading.
Entry conditions (long — reclaiming the bottom)
The mirror-image logic applies for longs: the bar's low reaches or dips below the opening-balance low but by no more than the maximum poke, the bar closes back inside (above the low), and the bar is bullish. The strategy takes at most one long and one short per session.
Stop-loss logic
- For shorts, the stop is placed
StopAtrMult× ATR above the rejected high; for longs, the same distance below the rejected low. Placing the stop just beyond the rejected extreme means the trade is invalidated if price genuinely breaks out.
Take-profit logic
- The target is set a
TargetFractionof the balance width back into the range, measured from the poked edge. With the default of 0.60, the trade aims for a level 60% of the way across the box toward the far side. A minimum target distance filter rejects setups where the reward would be degenerate (too small).
Break-even trail
- Once price travels
BreakevenAtr× ATR in the trade's favour, the stop is pulled to the entry price. This is a simple risk-reduction step that may help protect a position that moves the right way before reaching target.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| SessionStartHour | 7 | 0 | 23 | UTC hour at which a fresh session (and its opening balance) begins. |
| OpeningRangeBars | 4 | 1 | 16 | Number of bars from the start hour that form the opening-balance box. |
| SessionEndHour | 18 | 1 | 23 | UTC hour to stop taking trades and flatten all positions. |
| AtrPeriod | 14 | 5 | 30 | Lookback period for the ATR volatility measure. |
| MinRangeAtrMult | 1.00 | 0.20 | 4.00 | Opening-balance width must be at least this many ATRs to be worth fading. |
| MaxPokeAtrMult | 0.75 | 0.10 | 2.50 | Largest poke beyond the edge (in ATRs) still treated as a rejection, not a trend break. |
| TargetFraction | 0.60 | 0.30 | 1.00 | Take-profit as a fraction of the balance width, measured back in from the poked edge. |
| StopAtrMult | 0.80 | 0.30 | 3.00 | Stop distance beyond the rejected extreme, in ATRs. |
| BreakevenAtr | 0.80 | 0.00 | 3.00 | Move the stop to break-even once price travels this many ATRs in favour (0 = off). |
| Lots | 0.10 | 0.01 | 1.00 | Order volume in lots. |

Recommended Chart Settings
Opening Balance Reversion was designed for intraday forex and works on whatever timeframe is selected at backtest time. The strategy notes suggest liquid major pairs such as EURUSD or GBPUSD on the M15 (15-minute) timeframe, where the default OpeningRangeBars of 4 corresponds to the first hour of the session. The default session window of 07:00–18:00 UTC roughly spans the London and early New York hours, when these pairs are most active.
Because the strategy is anchored to UTC hours, always confirm how your broker's server time relates to UTC before adjusting SessionStartHour and SessionEndHour. Remember that results will vary considerably across different pairs, timeframes, brokers, and market conditions — the defaults are a starting point for study, not a prescription.
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
Strengths of the approach. The strategy is disciplined and clearly scoped. It only trades within a defined session window, never holds overnight, and caps itself at one attempt per side per session — all of which limit overtrading. The ATR-based runaway filter is a thoughtful attempt to avoid fading real trends, and the volatility-normalized stops and targets adapt position risk to current market conditions rather than using fixed pip distances. Its rules are fully mechanical, which makes it a clean example for studying how mean-reversion logic behaves on historical data.
Known limitations. Mean-reversion strategies share a well-documented weakness: they perform poorly on strong trend days, when price pushes through an "edge" and simply keeps going. The MaxPokeAtrMult filter helps, but no filter is perfect, and a series of trend days can produce a run of stop-outs. The opening-range concept is also sensitive to session timing — a poorly chosen SessionStartHour for a given market may capture the wrong part of the day's auction. Finally, like all opening-range systems, its behaviour depends heavily on the chosen timeframe and the number of bars used to build the balance.
Where it may underperform. Expect weaker behaviour during major news releases, low-liquidity periods, and sustained directional trends. Wide spreads and slippage on smaller or more exotic pairs can also erode the relatively modest per-trade targets this strategy aims for. Treat it as one component in a broader study of intraday behaviour rather than a standalone solution.
Risk Management Tips
Sound risk management matters far more than any single strategy. As you study this or any EA, keep these general principles in mind:
- Risk a small, fixed fraction per trade. Many educational sources suggest never risking more than 1–2% of account equity on a single position. Size your lots accordingly rather than using a fixed default without thought.
- Test on a demo account first. Run the strategy on a demo or simulated account for an extended period before ever considering real capital, so you can observe how it behaves across varied conditions.
- Understand drawdown. Every strategy experiences losing streaks. Study the maximum historical drawdown and ask yourself honestly whether you could tolerate it emotionally and financially.
- Backtest and forward-test. Historical backtests can be optimistic. Forward-testing on live-but-simulated data helps reveal how a strategy copes with real spreads, slippage, and execution delays.
- Diversify and stay humble. Avoid concentrating on a single strategy or instrument, and never trade with money you cannot afford to lose.
Risk management is not an afterthought — it is the foundation on which any systematic approach should be built.
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: OpeningBalanceReversion.ex5 (55 downloads)
- Source Code: OpeningBalanceReversion.mq5 (61 downloads)
- Documentation: OpeningBalanceReversion.pdf (54 downloads)