Trend Momentum EA
This EA trades momentum signals in the direction of the trend, defined by price being above or below both EMA 50 and EMA 200. It enters longs when RSI is deeply oversold (10-25) with a bullish stochastic crossover in an uptrend, and shorts when RSI is overbought (80-90) with a bearish stochastic crossover in a downtrend. Trading is restricted to London and New York sessions only.
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.74% | -0.64% | 8.60% | 73 | 36.10% | -0.12 | -0.09 | 7 | −$1.49 | Reliable |
| GBPUSD | +4.47% | +3.87% | 4.22% | 92 | 39.60% | 0.73 | 1.06 | 8 | +$4.65 | Reliable |
| USDJPY | -4.06% | -3.54% | 8.08% | 95 | 41.50% | -0.67 | -0.50 | 7 | −$4.16 | Reliable |
| XAUUSD | -70.59% | -63.62% | 93.97% | 129 | 45.30% | -0.49 | -0.75 | 7 | −$57.07 | 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 Momentum EAs with a reliable result on the same market: EURUSD: better than 44% of 68 · GBPUSD: better than 89% of 66 · USDJPY: better than 22% of 68 · XAUUSD: better than 32% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +2.78% 2026-10 | -2.05% 2026-04 |
| GBPUSD | 62% | +3.68% 2026-07 | -2.24% 2026-06 |
| USDJPY | 46% | +2.52% 2026-02 | -3.53% 2026-08 |
| XAUUSD | 46% | +39.94% 2026-11 | -50.00% 2026-09 |
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 concept combines trend filtering with momentum reversal entry — using EMA 50 and EMA 200 to determine the major trend direction, only seeking entries in the trend's direction. Buy entry requires price closing above both EMAs, RSI in the deeply oversold 10-25 zone, a bullish stochastic %K crossing above %D, and the last closed candle being bullish; sell conditions are symmetrically opposite. Exit conditions rely entirely on fixed stop loss (300 points) and take profit (600 points) with a 2:1 reward-to-risk ratio, with no trailing stop or partial close mechanism. Position sizing uses a fixed lot size (0.1 lots) without any dynamic adjustment based on account balance or volatility. Money management lacks risk-percentage calculation, maximum position limits, or drawdown controls. The strategy restricts trading to London and New York sessions, avoiding low-liquidity periods.
Strengths
- Sound trend filtering logic — dual EMA confirms trend direction and only trades with the trend, reducing counter-trend risk
- Uses completed candle (index[1]) instead of current candle for signals, avoiding signal flickering and repainting issues
- Complete indicator handle validation with proper INIT_FAILED return on failure, preventing runtime crashes
- Session filtering effectively avoids low-liquidity periods that cause slippage and false signals
- Fixed 2:1 reward-to-risk ratio provides a theoretical positive expectancy foundation
Weaknesses
- RSI buy zone (10-25) is extremely oversold, rarely triggered in an uptrend, potentially causing long periods without trades
- Fixed lot size doesn't scale with account size, making proper money management impossible — under-risked for large accounts, over-risked for small ones
- No new bar detection mechanism — full logic runs every tick, wasting computation and potentially retrying orders on the same candle
- Stop loss and take profit are in fixed points rather than ATR-based, creating vastly different risk exposure across varying volatility environments
- Single position only — no scaling in/out or partial close mechanism, limiting strategy flexibility
Possible improvements
- Add new bar detection (e.g., static datetime variable tracking last bar time) to avoid redundant computation and order attempts every tick
- Use ATR-based dynamic stop loss and take profit to adapt to different volatility environments, and replace fixed lot size with risk-percentage-based position sizing
- Widen RSI entry zones (e.g., 30-45 for buys, 55-70 for sells) or add RSI confirmation of recovery from oversold levels to increase trade frequency
- Add a spread filter to avoid entering during high-spread periods, especially before the London-New York overlap
Risk assessment
Overall risk: Medium
- No new bar detection may cause multiple order attempts on the same candle — while PositionSelectByMagic limits multiple positions, it generates unnecessary order requests
- Fixed point stop loss creates vastly different actual risk across instruments and volatility — 300 points means very different things on EURUSD vs XAUUSD
- Lack of spread filter means high-spread periods could make actual stop loss much larger than expected
- Single position limit combined with extremely strict RSI zones may lead to long periods without trades, leaving capital idle
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
InpEMA50 | 50 | Fast EMA period |
InpEMA200 | 200 | Slow EMA period |
InpRSI | 14 | RSI period |
InpStochK | 5 | Stochastic %K period |
InpStochD | 3 | Stochastic %D period |
InpStochSlowing | 3 | Stochastic smoothing period |
InpLondonStart | 8 | London session start hour |
InpLondonEnd | 16 | London session end hour |
InpNYStart | 13 | New York session start hour |
InpNYEnd | 21 | New York session end hour |
InpLotSize | 0.1 | Fixed lot size |
InpStopLoss | 300 | Stop loss in points |
InpTakeProfit | 600 | Take profit in points |
InpMagicNum | 123456 | Magic number |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.