MA Reverse
This EA implements a mean reversion strategy based on moving average deviation. It enters trades when price reverses from an extreme deviation away from a moving average, expecting price to revert back toward the MA. Trades are opened in the direction of the expected reversion with configurable lot sizing and stop loss.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | -0.50% | -0.44% | 4.07% | 98 | 50.50% | -0.11 | -0.12 | 8 | −$0.17 | Reliable |
| GBPUSD | +3.60% | +3.12% | 4.31% | 101 | 49.50% | 0.71 | 0.83 | 7 | +$3.57 | Reliable |
| USDJPY | -0.78% | -0.68% | 5.25% | 96 | 49.00% | -0.15 | -0.15 | 6 | −$0.81 | Reliable |
| XAUUSD | +31.50% | +25.39% | 54.85% | 94 | 54.80% | 0.71 | 0.57 | 6 | +$36.54 | Reliable |
Profitable on 2 of 4 markets with reliable results.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Against the other Mean Reversion EAs with a reliable result on the same market: EURUSD: better than 60% of 30 · GBPUSD: better than 78% of 32 · USDJPY: better than 44% of 32 · XAUUSD: better than 52% of 31
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +2.99% 2026-04 | -1.55% 2026-10 |
| GBPUSD | 54% | +3.09% 2026-04 | -2.54% 2026-10 |
| USDJPY | 23% | +2.99% 2026-07 | -1.84% 2026-03 |
| XAUUSD | 54% | +39.24% 2026-01 | -26.03% 2026-03 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core strategy concept of this EA is mean reversion, expecting price to return to the moving average after significant deviation. Entry conditions trigger when price deviates from the MA beyond a threshold and shows reversal confirmation, such as candlestick patterns or momentum shifts. Exit conditions include take-profit when price reverts to the MA zone, or a fixed stop-loss level. Position sizing uses fixed lot sizes, with some versions potentially supporting balance-based proportional sizing. Money management relies on stop-loss settings but lacks dynamic adjustment mechanisms. The overall strategy logic is straightforward but may suffer consecutive losses in strong trending markets due to counter-trend trading.
Strengths
- Simple and clear strategy logic, easy to understand and debug
- Mean reversion performs well in ranging markets with statistical edge
- Highly configurable parameters suitable for optimization across instruments and timeframes
Weaknesses
- Counter-trend trading in strong trending markets leads to consecutive losses
- Lacks trend filter to distinguish between ranging and trending market conditions
- Fixed lot size and stop-loss lack dynamic money management mechanisms
Possible improvements
- Add a trend filter (e.g., ADX or higher timeframe MA direction) to avoid counter-trend entries in strong trends
- Implement ATR-based dynamic stop-loss and take-profit to adapt to changing market volatility
Risk assessment
Overall risk: Medium
- Counter-trend trading can cause consecutive stop-losses in strong trending markets
- Lacks trend identification and volatility filtering mechanisms
- Fixed stop-loss may not adapt to varying market volatility environments
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MAPeriod | 20 | Moving average period |
MAMethod | MODE_SMA | MA calculation method |
MAAppliedPrice | PRICE_CLOSE | MA applied price |
DeviationPips | 30 | Entry deviation threshold in pips |
LotSize | 0.1 | Fixed trading lot size |
StopLoss | 50 | Initial stop loss distance, 0 for no initial SL |
TakeProfit | 30 | Take profit per order in pips |
MagicNumber | 12345 | Magic number to identify EA positions, 0 for all positions |
Similar Mean Reversion EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.