MovingAverageMartinGale
This EA trades based on a simple moving average crossover with price, opening buy or sell positions when the MA crosses above or below the candle close. It employs a Martingale position sizing strategy, doubling the lot size after each losing trade while also multiplying TP and SL distances, and resetting to initial values after a winning trade.
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 | -1.62% | -1.41% | 5.36% | 94 | 50.50% | -0.35 | -0.30 | 4 | −$2.10 | Reliable |
| GBPUSD | -2.44% | -2.13% | 5.46% | 103 | 50.50% | -0.41 | -0.45 | 6 | −$2.37 | Reliable |
| USDJPY | -3.21% | -2.79% | 6.09% | 97 | 47.40% | -0.78 | -0.53 | 7 | −$3.31 | Reliable |
| XAUUSD | +12.36% | +10.11% | 77.63% | 102 | 51.50% | 0.86 | 0.16 | 4 | +$9.80 | Reliable |
Profitable on 1 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 Martingale EAs with a reliable result on the same market: EURUSD: better than 38% of 16 · GBPUSD: better than 20% of 15 · USDJPY: better than 19% of 16 · XAUUSD: better than 38% of 16
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 38% | +1.34% 2026-10 | -1.65% 2026-03 |
| GBPUSD | 38% | +2.00% 2026-03 | -2.70% 2026-07 |
| USDJPY | 46% | +1.91% 2026-03 | -2.00% 2026-07 |
| XAUUSD | 46% | +56.46% 2026-03 | -33.57% 2026-01 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: Elevated
- Increases the position size after losses (martingale)
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 strategy concept is based on a moving average crossover with price: it goes long when the MA crosses above the price and goes short when it crosses below, essentially a trend-following signal. Entry conditions are triggered on a new candle when the MA value at shift 1 crosses over the previous close and current close prices. Exit conditions use fixed-point take profit and stop loss, with initial TP of 100 points and SL of 300 points, resulting in a risk-reward ratio of 1:3. Position sizing follows a Martingale approach: after a loss, the lot size is multiplied by 2 (capped at 0.5 lots), and after a win, it resets to the starting lot of 0.01. Money management is flawed because both TP and SL distances are also multiplied by the same factor, meaning each successive losing trade exponentially increases the total risk exposure, creating a dangerous path toward account blow-up.
Strengths
- Martingale lot sizing has a MaxLot cap to prevent unlimited position increase
- Automatically resets lot size and TP/SL after a profitable trade, locking in gains
- Trades only on new candle formation, avoiding repeated entries within the same bar
- Uses CheckVolumeValue to validate lot size before placing orders
Weaknesses
- Martingale strategy is inherently dangerous; exponential risk growth after consecutive losses can easily blow the account
- TP and SL distances scale with the Martingale multiplier, making individual losses enormous in later stages
- No maximum consecutive loss limit and no account equity drawdown protection
- Stop loss is 3x the take profit, so even without position scaling each trade has negative expected value
- MA crossover signals are heavily lagging, prone to frequent false breakouts in ranging markets leading to consecutive losses
Possible improvements
- Add a maximum Martingale step limit and account drawdown protection to stop scaling or close positions when thresholds are breached
- Decouple TP/SL distance scaling from lot multiplier — only increase lot size without widening stop loss to cap per-trade risk
- Add a trend filter and ranging market detection to avoid frequent entries during sideways conditions
Risk assessment
Overall risk: Dangerous
- Martingale strategy causes exponential risk growth after consecutive losses; later-stage single-trade losses can far exceed account capacity
- Stop loss distance scaling multiplies the actual monetary loss per trade
- 1:3 risk-reward ratio combined with Martingale can produce catastrophic losses during trend reversals
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MAPeriod | 50 | Moving average period |
StartingLot | 0.01 | Starting lot size |
MaxLot | 0.5 | Maximum allowed lot size |
TPPoints | 100 | Take profit in points |
SLPoints | 300 | Stop loss in points |
LotMultiplier | 2 | Lot multiplier after a loss |
TPMultiplier | 2 | TP/SL distance multiplier after a loss |
Similar Martingale EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.