EMA_CROSS
This EA trades EMA crossover signals between a short-period and long-period EMA. It opens buy positions when the short EMA crosses above the long EMA and sell positions on the opposite cross, with fixed take-profit, stop-loss, and a trailing stop for open position management.
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 | +3.05% | +2.65% | 2.94% | 82 | 56.80% | 0.82 | 1.04 | 5 | +$4.19 | Reliable |
| GBPUSD | -1.88% | -1.64% | 4.88% | 89 | 43.80% | -0.36 | -0.39 | 8 | −$2.11 | Reliable |
| USDJPY | +0.98% | +0.85% | 4.51% | 82 | 51.20% | 0.26 | 0.22 | 5 | +$1.20 | Reliable |
| XAUUSD | -18.89% | -15.89% | 75.82% | 80 | 57.50% | 0.31 | -0.25 | 4 | −$23.61 | 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 Trend Following EAs with a reliable result on the same market: EURUSD: better than 77% of 95 · GBPUSD: better than 32% of 95 · USDJPY: better than 63% of 95 · XAUUSD: better than 35% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +1.98% 2026-04 | -1.56% 2026-10 |
| GBPUSD | 54% | +1.82% 2026-07 | -2.68% 2026-10 |
| USDJPY | 38% | +2.75% 2026-04 | -1.95% 2026-03 |
| XAUUSD | 62% | +42.99% 2026-09 | -39.09% 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 strategy is based on a dual Exponential Moving Average (EMA) crossover, a classic trend-following approach. Entry conditions trigger when the short-period EMA crosses the long-period EMA: a buy signal occurs on an upward cross and a sell signal on a downward cross, with a Reverse parameter to invert signal direction. Exit conditions include fixed take-profit and stop-loss levels, plus a trailing stop that moves the stop-loss to lock in profits when the position's floating profit exceeds the trailing distance. Position sizing uses a fixed lot size (Lots parameter) with no dynamic money management based on account equity — a TODO comment in the code explicitly acknowledges this gap. The trailing stop only adjusts the stop-loss without modifying take-profit, handling long and short positions separately. The strategy has no pyramiding, partial close, or scaled entry logic, and only holds a single-direction position at a time.
Strengths
- Simple and clear strategy logic — EMA crossover is a proven trend-following method
- Includes a trailing stop feature that effectively locks in floating profits
- Supports signal reversal via the Reverse parameter for flexible market adaptation
- Uses standard MT5 trade class libraries (CTrade/CPositionInfo/CSymbolInfo) for clean code structure
Weaknesses
- No money management module — fixed lot size does not adapt to account balance, making risk exposure uncontrollable
- No new bar check — the crossover is recalculated every tick, risking signal drift and redundant trade attempts
- Take-profit of 25 points is far smaller than stop-loss of 105 points, yielding a risk-reward ratio of ~0.24:1 which requires very high win rate
- Crossed() function relies on static variables for state, losing directional history on EA restart
- No spread filter — trades can be opened during high-spread periods, eroding small take-profit targets
Possible improvements
- Add a money management module that dynamically calculates lot size based on account balance and risk percentage
- Add a new bar check to ensure each signal triggers only once per completed bar
- Optimize risk-reward ratio — consider widening take-profit or using a dynamic take-profit strategy
- Add a spread filter to prevent entries during high-spread periods
- Persist the Crossed() function state or rebuild initial direction in OnInit() to survive restarts
Risk assessment
Overall risk: Caution
- Severely imbalanced risk-reward ratio (TP 25 vs SL 105), requiring ~81%+ win rate for long-term profitability
- No new bar check — trade signals may fire repeatedly on the same bar
- Fixed lot sizing with no money management — large positions can cause excessive single-trade losses
- Trailing stop distance (20 points) is much smaller than stop-loss (105 points), potentially stopping out prematurely
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Reverse | true | Whether to reverse trading signal direction |
InpTakeProfit | 25 | Take profit in points |
InpStopLoss | 105 | Stop loss in points |
Lots | 0.5 | Fixed trading lot size |
InpTrailingStop | 20 | Trailing stop in points |
ShortEma | 9 | Short-term EMA period |
LongEma | 45 | Long-term EMA period |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.