Skip to content

Free MT5 Expert Advisor

XAU Quant Reversion (TickRobust)

Open-source M1 gold mean-reversion EA by Neo Malesa: z-score stretch, ADX range filter, cost gate and broker-side stops.

Mean reversionv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Stop-loss on every trade
Strategy
Fades closes more than 2.2 standard deviations from the 20-bar mean once momentum turns, only in low-ADX range conditions and when the move covers trading costs.
Risk model
Server-side stop of max(800 points, 2.5 × ATR), break-even after 1 × ATR, 40-bar time exit, cooldown after a loss, Friday close.

What it does

An open-source gold mean-reversion Expert Advisor written by Neo Malesa and published under the MIT licence. FXPIPS hosts an unmodified compiled copy of the TickRobust variant with its licence; the original repository is linked above. Only this variant is included because the author's other files use much higher risk tiers.

How it works

A trade needs all of the following on closed M1 bars:

  1. Stretch: the close is more than 2.2 standard deviations from the 20-bar SMA (z-score).
  2. Turn: the last closed bar stopped extending the stretch.
  3. Range regime: ADX(14) at or below 22, so it stands aside in trends.
  4. Volatility regime: ATR between 0.4 and 2.0 times its 50-bar average.
  5. Cost gate: the distance to the mean must be several times the round-trip trading cost.
  6. Filters: spread limit, trading hours, high-impact USD news from the MQL5 calendar, a cooldown after a loss, optional H1 trend alignment.

Exits: target at the mean (recalculated each bar), a z-score back inside ±0.2, a 40-bar time limit, break-even after 1 × ATR and a server-side stop.

How to use it

Attach it to an XAUUSD M1 chart and set the symbol input to your broker's exact name. It is designed to trade quiet, ranging hours and will stay out of strong trends.

Settings

InputDefaultWhat it changes
Trade symbolGOLDSymbol the EA trades
Entry Z2.2How stretched price must be
Exit Z0.2Backup exit when price returns to the mean
Max hold40 barsTime exit
Min SL / ATR multiple800 points / 2.5Stop distance
Trading window10–20 broker timeAllowed hours

Limitations

The minimum stop of 800 points is large relative to small accounts, and mean reversion can suffer badly when a range turns into a trend. MetaEditor reports three minor warnings in the original code; they do not stop it compiling.

Before you run it live

Read the licence and the original repository's notes, test with real ticks in the Strategy Tester, and run it on a demo account first. FXPIPS did not write this EA and does not provide support for it.

Key inputs

Key inputs of XAU Quant Reversion (TickRobust)
InputDefaultDescription
Trade symbolGOLDSet to your broker's exact gold symbol (XAUUSD, GOLD, XAUUSD.m...).
Entry Z-score2.2Stretch from the 20-bar mean needed to enter.
Min SL points800Floor for the stop-loss distance.
Trading window10:00–20:00 broker timeHours in which new trades are allowed.

Educational tools, not advice. Automated trading can lose money quickly. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 expert advisors