EA-16849 · Trend Following

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

RiskCaution
Blow-up riskLow
Rating★★☆☆☆
TypeTrading EA
TimeframesM15, H1, H4
IndicatorsEMA
AuthorCoders Guru

Backtest results (H1, about 1 year)

SymbolP&LAnnualMax DDTradesWin rateSharpeRecoveryLosing streakPer tradeStatus
EURUSD+3.05%+2.65%2.94%8256.80%0.821.045+$4.19Reliable
GBPUSD-1.88%-1.64%4.88%8943.80%-0.36-0.398−$2.11Reliable
USDJPY+0.98%+0.85%4.51%8251.20%0.260.225+$1.20Reliable
XAUUSD-18.89%-15.89%75.82%8057.50%0.31-0.254−$23.61Reliable

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

MarketMonths with a gainBest monthWorst month
EURUSD54%+1.98% 2026-04-1.56% 2026-10
GBPUSD54%+1.82% 2026-07-2.68% 2026-10
USDJPY38%+2.75% 2026-04-1.95% 2026-03
XAUUSD62%+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

Code quality3.0
Strategy logic2.0
Risk management2.0
Robustness2.0
Innovation1.0
Documentation2.0
Overall2.0

Parameters

ParameterDefaultDescription
ReversetrueWhether to reverse trading signal direction
InpTakeProfit25Take profit in points
InpStopLoss105Stop loss in points
Lots0.5Fixed trading lot size
InpTrailingStop20Trailing stop in points
ShortEma9Short-term EMA period
LongEma45Long-term EMA period

Similar Trend Following EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.