Asia Range Mean Reversion
- Experts
- Version: 1.1
EA description: EA_XAU_Asia_Range_MR_FINAL (XAUUSD) – Asia Range Mean Reversion
Brief profile
This Expert Advisor trades gold (XAUUSD) as a mean reversion system in the Asia session (server time UTC+1, default 01:00–07:00). It establishes an Asia range at the beginning of the session and then attempts to trade exaggerations at the edges of the range back to the centre (or alternatively to the opposite side). In doing so, it uses consistent risk and execution safeguards such as spread/ATR filters, daily limits, cooldown, master portfolio gates, as well as StopLevel security and filling fallback.
Strategy logic (what the EA does)
1) Session window: Asia (UTC+1)
The EA is only active within the defined Asia time: 01:00 to 07:00.
No new trades are opened outside this window.
2) Range building (first N minutes)
Immediately after the session starts, a range is formed from the first InpBuildMinutes minutes (default: 45 min).
The high/low of these M1 candles are stored as range limits:
g_hi (range high)
g_lo (range low)
Trading only takes place after the build time has elapsed.
3) Entry: Fade of the range extremes (mean reversion)
The EA searches within the session for prices close to the range edges:
BUY if the ask is close to the range low
(ask ≤ low + entry buffer)
SELL if the bid is close to the range high
(bid ≥ high − entry buffer)
The EA thus trades contrary to the movement at the edge – the goal is a pullback.
4) Take profit mode
Two TP options:
TP to the middle of the range (mid-target) (default)
or TP to the opposite edge of the range
Additionally with TP buffer so that the EA is not dependent on ‘perfect’ levels.
5) Stop-loss logic (range-based)
SL is outside the range:
BUY: SL below range low minus SL buffer
SELL: SL above range high plus SL buffer
Risk, filter and safety modules
ATR filter (volatility gate)
Trade only if ATR (M15) is within the corridor:
Min ATR: no ‘dead’ session
Max ATR: no extreme volatility/chaos phase
Spread filter
Optional gatekeeper:
Trade only if spread ≤ InpMaxSpreadPoints
Position and frequency control
Max 2 trades per day
Cooldown after each trade (default: 60 minutes)
No new trades if a position with the same magic number is already open
Master portfolio gates (optional)
Blocks trading if one of the global variables is active:
MASTER_RISK_STATUS (daily lock)
MASTER_PORTFOLIO_FULL
MASTER_CLUSTER_METAL_LOCK
Broker robustness
StopLevel-safe (SL/TP are adjusted to minimum distances)
Filling fallback: RETURN -> IOC -> FOK (broker-safe in case of execution differences)
New bar only: Decision logic is only executed on new M15 candles (more stable, less overtrading)
Who is the EA intended for?
For traders who want to take advantage of Asia range reversion in gold
For setups with controlled frequency and clear volatility conditions
Particularly useful in phases when XAU often trades sideways/range-heavy in Asia
Important note (realistic & practical)
Mean reversion approaches work best in range regimes. In strong trend phases (e.g. news runs, breakouts towards the London open), the system may run against the move more frequently. This is exactly why the ATR/spread filters, daily limits and cooldown are crucial.
Brief profile
This Expert Advisor trades gold (XAUUSD) as a mean reversion system in the Asia session (server time UTC+1, default 01:00–07:00). It establishes an Asia range at the beginning of the session and then attempts to trade exaggerations at the edges of the range back to the centre (or alternatively to the opposite side). In doing so, it uses consistent risk and execution safeguards such as spread/ATR filters, daily limits, cooldown, master portfolio gates, as well as StopLevel security and filling fallback.
Strategy logic (what the EA does)
1) Session window: Asia (UTC+1)
The EA is only active within the defined Asia time: 01:00 to 07:00.
No new trades are opened outside this window.
2) Range building (first N minutes)
Immediately after the session starts, a range is formed from the first InpBuildMinutes minutes (default: 45 min).
The high/low of these M1 candles are stored as range limits:
g_hi (range high)
g_lo (range low)
Trading only takes place after the build time has elapsed.
3) Entry: Fade of the range extremes (mean reversion)
The EA searches within the session for prices close to the range edges:
BUY if the ask is close to the range low
(ask ≤ low + entry buffer)
SELL if the bid is close to the range high
(bid ≥ high − entry buffer)
The EA thus trades contrary to the movement at the edge – the goal is a pullback.
4) Take profit mode
Two TP options:
TP to the middle of the range (mid-target) (default)
or TP to the opposite edge of the range
Additionally with TP buffer so that the EA is not dependent on ‘perfect’ levels.
5) Stop-loss logic (range-based)
SL is outside the range:
BUY: SL below range low minus SL buffer
SELL: SL above range high plus SL buffer
Risk, filter and safety modules
ATR filter (volatility gate)
Trade only if ATR (M15) is within the corridor:
Min ATR: no ‘dead’ session
Max ATR: no extreme volatility/chaos phase
Spread filter
Optional gatekeeper:
Trade only if spread ≤ InpMaxSpreadPoints
Position and frequency control
Max 2 trades per day
Cooldown after each trade (default: 60 minutes)
No new trades if a position with the same magic number is already open
Master portfolio gates (optional)
Blocks trading if one of the global variables is active:
MASTER_RISK_STATUS (daily lock)
MASTER_PORTFOLIO_FULL
MASTER_CLUSTER_METAL_LOCK
Broker robustness
StopLevel-safe (SL/TP are adjusted to minimum distances)
Filling fallback: RETURN -> IOC -> FOK (broker-safe in case of execution differences)
New bar only: Decision logic is only executed on new M15 candles (more stable, less overtrading)
Who is the EA intended for?
For traders who want to take advantage of Asia range reversion in gold
For setups with controlled frequency and clear volatility conditions
Particularly useful in phases when XAU often trades sideways/range-heavy in Asia
Important note (realistic & practical)
Mean reversion approaches work best in range regimes. In strong trend phases (e.g. news runs, breakouts towards the London open), the system may run against the move more frequently. This is exactly why the ATR/spread filters, daily limits and cooldown are crucial.
