Simple EA MA plus MACD
This EA combines a Moving Average crossover or filter with the MACD indicator to generate trend-following trade signals. It enters long positions when the MA signals an uptrend and MACD confirms bullish momentum, and enters short positions under the opposite conditions. The strategy is a classic dual-indicator trend-following system suitable for trending markets.
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.93% | -0.81% | 3.68% | 109 | 49.10% | -0.22 | -0.25 | 6 | −$0.55 | Reliable |
| GBPUSD | +6.69% | +5.79% | 4.59% | 107 | 51.40% | 1.20 | 1.46 | 8 | +$6.25 | Reliable |
| USDJPY | +3.63% | +3.14% | 4.42% | 99 | 51.50% | 0.77 | 0.82 | 6 | +$3.66 | Reliable |
| XAUUSD | -3.39% | -2.81% | 49.78% | 104 | 51.50% | 0.34 | -0.07 | 5 | −$0.88 | 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 45% of 95 · GBPUSD: better than 93% of 95 · USDJPY: better than 85% of 95 · XAUUSD: better than 47% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 46% | +2.70% 2026-04 | -1.11% 2026-01 |
| GBPUSD | 69% | +2.65% 2026-04 | -2.56% 2026-10 |
| USDJPY | 54% | +2.91% 2026-04 | -1.88% 2026-03 |
| XAUUSD | 54% | +19.82% 2026-01 | -32.50% 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
The core strategy concept uses a Moving Average to determine trend direction and the MACD indicator to confirm momentum, representing a classic trend-following approach. Entry conditions involve going long when price is above the MA (or a fast MA crosses above a slow MA) and MACD histogram is positive or the signal line crosses upward; short conditions are the reverse. Exit conditions typically rely on MACD reverse crossovers or MA trend reversal signals, and may also include configurable stop-loss and take-profit parameters. Position sizing uses fixed lot parameters, though some variants may include balance-based dynamic lot calculation. Money management includes maximum position limits and stop-loss settings, but the basic MA plus MACD combination lacks adaptive position adjustment and drawdown control mechanisms. The overall strategy performs well in strong trending markets but is prone to frequent false signals and consecutive losses during ranging or choppy conditions.
Strengths
- Simple and clear strategy logic that is easy to understand and debug, suitable for beginners learning EA development
- Dual indicator confirmation mechanism (MA+MACD) reduces false signals from a single indicator
- Highly configurable parameters allow users to flexibly adjust indicator settings for different instruments and timeframes
Weaknesses
- Both MA and MACD generate numerous false signals during ranging markets, leading to frequent opening and closing of losing trades
- Lacks advanced money management mechanisms such as dynamic position sizing, maximum drawdown control, and new bar checking
- Default stop-loss and take-profit are zero, users must manually configure them or face extremely high trading risk
Possible improvements
- Add a trend filter and ranging market detection mechanism, such as the ADX indicator, to pause trading during low trend strength and avoid false signals in sideways markets
- Implement equity-based dynamic position sizing and maximum drawdown limits to improve capital safety and strategy robustness
Risk assessment
Overall risk: Medium
- Default stop-loss and take-profit are zero, creating unlimited loss risk if users do not manually configure them
- Lacks new bar checking mechanism, potentially causing excessive trading by repeatedly opening and closing positions within the same candle
- Trend-following strategy produces consecutive losses in ranging markets with no overall drawdown control
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MAPeriod | 14 | Moving average period |
MAMethod | MODE_SMA | Moving average calculation method |
MAAppliedPrice | PRICE_CLOSE | Moving average applied price |
FastEMA_Period | 12 | MACD fast EMA period |
SlowEMA_Period | 26 | MACD slow EMA period |
SignalSMA_Period | 9 | MACD signal SMA period |
LotSize | 0.1 | Trade lot size per order |
StopLoss | 0 | Stop loss in points |
TakeProfit | 0 | Overall take profit target in points |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.