UniversalMACrossEA
A universal moving average crossover EA that generates trade signals when a fast moving average crosses a slow moving average. It supports multiple MA types (SMA, EMA, SMMA, LWMA) and applies to any symbol and timeframe, with configurable lot sizing, stop loss, and take profit. The EA opens buy positions on bullish crossovers and sell positions on bearish crossovers, optionally closing opposite positions on new signals.
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 | -2.12% | -1.85% | 4.20% | 101 | 49.00% | -0.51 | -0.51 | 7 | −$1.78 | Reliable |
| GBPUSD | +2.54% | +2.20% | 5.08% | 99 | 48.50% | 0.50 | 0.50 | 7 | +$2.57 | Reliable |
| USDJPY | +2.49% | +2.16% | 3.84% | 94 | 47.90% | 0.57 | 0.65 | 5 | +$2.65 | Reliable |
| XAUUSD | +27.38% | +22.13% | 60.75% | 93 | 53.30% | 0.68 | 0.45 | 7 | +$32.45 | Reliable |
Profitable on 3 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 Trend Following EAs with a reliable result on the same market: EURUSD: better than 33% of 95 · GBPUSD: better than 67% of 95 · USDJPY: better than 77% of 95 · XAUUSD: better than 72% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +2.04% 2026-04 | -1.64% 2026-10 |
| GBPUSD | 62% | +2.38% 2026-04 | -2.57% 2026-10 |
| USDJPY | 46% | +3.09% 2026-07 | -1.90% 2026-03 |
| XAUUSD | 54% | +44.68% 2026-04 | -30.37% 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 of this EA is the classic dual moving average crossover system, using the golden cross and death cross of a fast and slow moving average as trend determination signals. Entry conditions are: open a buy position when the fast MA crosses above the slow MA (golden cross), and open a sell position when the fast MA crosses below the slow MA (death cross). Exit conditions depend on the configured stop loss and take profit parameters, with an optional feature to close opposite positions on new crossover signals. Position sizing uses a fixed lot size approach without any dynamic adjustment based on account equity or risk percentage. Money management provides only basic stop loss and take profit controls, lacking advanced risk management features such as trailing stops, partial closes, or breakeven functionality. While the EA supports multiple MA algorithm types for added flexibility, it remains fundamentally a simple trend-following system that is prone to generating frequent false signals and consecutive losses during choppy, range-bound market conditions.
Strengths
- Simple and clear strategy logic that is easy to understand and verify, suitable for beginners learning MA crossover systems
- Supports multiple MA types and applied price types, offering high flexibility to adapt to different market characteristics
- Highly universal — can be applied to any symbol and timeframe without code modification
- Provides the close-on-opposite-signal option, enabling timely exit from current positions on trend reversal
Weaknesses
- Lacks dynamic position sizing; fixed lots cannot adapt to account risk and market volatility
- No trailing stop or breakeven functionality, meaning profitable positions may give back all gains during pullbacks
- Stop loss and take profit default to 0, meaning no SL/TP is set, creating extreme capital risk
- Generates numerous false crossover signals in ranging/choppy markets, leading to frequent open/close cycles and consecutive losses
- Lacks a new bar check mechanism, potentially opening multiple positions on the same candle
Possible improvements
- Add dynamic position sizing based on account equity percentage or ATR volatility for automatic lot calculation
- Implement trailing stop and breakeven functionality to protect profits and optimize exit strategies
- Add a ranging market filter (such as ADX or Bollinger Band width) to avoid frequent trading during consolidation phases
- Add new bar check and position check logic to prevent duplicate entries on the same candle and over-exposure
Risk assessment
Overall risk: High risk
- Stop loss and take profit default to 0; if users do not manually set them, trades have no risk protection at all
- No new bar check mechanism may cause repeated signal triggers on the same candle leading to over-trading
- No check on current position count may cause duplicate same-direction entries leading to excessive exposure
- Lack of trailing stop mechanism leaves profitable positions unprotected, potentially turning gains into losses
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
FastMA_Period | 10 | Fast MA period |
SlowMA_Period | 50 | Slow MA period |
FastMA_Method | MODE_SMA | fastMAmethod (SMA/EMA/SMMA/LWMA) |
SlowMA_Method | MODE_SMA | slowMAmethod (SMA/EMA/SMMA/LWMA) |
FastMA_AppliedPrice | PRICE_CLOSE | fastMAapplied price type |
SlowMA_AppliedPrice | PRICE_CLOSE | slowMAapplied price type |
Lots | 0.1 | Fixed trading lot size |
StopLoss | 0 | stop losspoints (0meansnostop loss) |
TakeProfit | 0 | take profitpoints (0meansnotake profit) |
CloseOnOpposite | true | Close existing position on opposite signal |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.