- 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:
- Stretch: the close is more than 2.2 standard deviations from the 20-bar SMA (z-score).
- Turn: the last closed bar stopped extending the stretch.
- Range regime: ADX(14) at or below 22, so it stands aside in trends.
- Volatility regime: ATR between 0.4 and 2.0 times its 50-bar average.
- Cost gate: the distance to the mean must be several times the round-trip trading cost.
- 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
| Input | Default | What it changes |
|---|---|---|
| Trade symbol | GOLD | Symbol the EA trades |
| Entry Z | 2.2 | How stretched price must be |
| Exit Z | 0.2 | Backup exit when price returns to the mean |
| Max hold | 40 bars | Time exit |
| Min SL / ATR multiple | 800 points / 2.5 | Stop distance |
| Trading window | 10–20 broker time | Allowed 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.

