Crossing of two iMA
This EA implements a classic dual moving average crossover strategy, generating buy signals when a fast moving average crosses above a slow moving average and sell signals when the fast MA crosses below the slow MA. It uses the built-in iMA indicator of MQL5 for both moving average calculations. Trades are opened on crossover signals with configurable lot size, stop loss, and take profit levels.
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.13% | -2.73% | 4.46% | 117 | 50.00% | -0.71 | -0.70 | 4 | −$2.41 | Reliable |
| GBPUSD | +2.92% | +2.53% | 4.08% | 116 | 49.60% | 0.53 | 0.72 | 8 | +$2.74 | Reliable |
| USDJPY | -1.72% | -1.50% | 5.81% | 110 | 48.20% | -0.32 | -0.30 | 6 | −$1.56 | Reliable |
| XAUUSD | -1.82% | -1.51% | 58.51% | 111 | 49.10% | 0.34 | -0.03 | 7 | +$0.60 | 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 Trend Following EAs with a reliable result on the same market: EURUSD: better than 22% of 95 · GBPUSD: better than 72% of 95 · USDJPY: better than 35% of 95 · XAUUSD: better than 48% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 31% | +1.57% 2026-04 | -1.51% 2026-01 |
| GBPUSD | 62% | +2.68% 2025-12 | -2.63% 2026-10 |
| USDJPY | 46% | +2.88% 2026-04 | -2.14% 2026-03 |
| XAUUSD | 46% | +49.38% 2026-02 | -29.03% 2026-08 |
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
This EA employs a dual moving average crossover trend-following strategy, where the core concept is using the intersection of two moving averages with different periods to detect trend direction changes. Entry conditions are straightforward: a buy signal is generated when the fast MA crosses above the slow MA, and a sell signal is triggered when the fast MA crosses below the slow MA, which essentially captures trend reversal moments. Exit conditions rely on fixed stop loss and take profit parameters, closing positions when price hits the preset SL or TP levels, and reverse crossover signals may also trigger position closure. Position sizing uses a fixed lot size specified by the Lots parameter, with no dynamic adjustment mechanism based on account equity or balance. Money management is relatively simplistic, relying solely on the stop loss to take profit ratio to control the risk-reward profile of each trade, lacking account-level risk controls such as maximum drawdown limits or percentage-based position sizing. The overall strategy logic is clear but basic, representing a typical entry-level trend-following approach.
Strengths
- Strategy logic is simple and clear, easy to understand and verify, suitable for beginners to learn from and improve
- Uses MQL5 built-in iMA indicator handles for efficient calculation consistent with platform standards
- Configurable stop loss and take profit parameters provide a basic risk control framework
Weaknesses
- Fixed lot sizing cannot dynamically adjust position size based on account size and volatility, making money management crude
- MA crossover strategies generate numerous false signals in ranging/choppy markets leading to frequent losses
- Lacks new bar detection mechanism, potentially opening redundant trades on the same bar
Possible improvements
- Add new bar detection logic to ensure each crossover signal triggers only one trade, avoiding redundant entries
- Implement ATR-based dynamic stop loss and position sizing to adaptively adjust risk parameters based on market volatility
Risk assessment
Overall risk: Medium
- Lack of new bar detection may cause repeated entries on the same signal, increasing unnecessary risk exposure
- Frequent false signals in ranging markets may lead to consecutive stop losses and accumulated losses
- Fixed lot size does not adjust with account balance, potentially unable to sustain trading after significant drawdown
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
FastMA_period | 10 | Fast MA period |
SlowMA_period | 30 | Slow MA period |
Lots | 0.1 | Fixed trading lot size |
StopLoss | 50 | Stop loss in points |
TakeProfit | 100 | Take profit in points |
MA_method | MODE_SMA | MAmethod (SMA/EMA/SMMA/LWMA) |
MA_applied_price | PRICE_CLOSE | MA applied price type |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.