ADX & MA
This EA combines the ADX indicator with a Moving Average to identify and trade trending markets. It enters long positions when ADX confirms a strong trend and price is above the MA, and enters short positions when ADX confirms a strong trend and price is below the MA. The strategy aims to capture directional moves while filtering out ranging or weak-trend market conditions.
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 | -4.15% | -3.62% | 5.33% | 43 | 37.20% | -1.85 | -0.78 | 7 | −$9.66 | Reliable |
| GBPUSD | -2.71% | -2.36% | 5.66% | 43 | 44.20% | -0.75 | -0.48 | 6 | −$6.31 | Reliable |
| USDJPY | +3.40% | +2.95% | 1.86% | 43 | 60.50% | 1.21 | 1.83 | 4 | +$7.91 | Reliable |
| XAUUSD | +27.28% | +22.06% | 43.23% | 50 | 55.10% | 0.66 | 0.63 | 5 | +$60.74 | 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 14% of 95 · GBPUSD: better than 26% of 95 · USDJPY: better than 84% of 95 · XAUUSD: better than 71% of 96
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 23% | +0.55% 2026-04 | -1.48% 2026-01 |
| GBPUSD | 46% | +2.05% 2026-04 | -2.35% 2026-05 |
| USDJPY | 77% | +1.03% 2026-02 | -0.60% 2026-08 |
| XAUUSD | 54% | +32.72% 2026-02 | -20.62% 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 concept is based on trend following, using the ADX indicator to measure trend strength combined with a Moving Average to determine trend direction. Entry conditions require the ADX value to exceed a configured threshold, confirming sufficient trend strength, while the price relationship to the MA dictates trade direction — going long when price crosses above the MA and short when it crosses below. Exit conditions typically involve a reverse signal trigger or fixed stop-loss/take-profit levels, closing positions when ADX falls below the threshold or price reverses across the MA. Position sizing uses either a fixed lot size or an equity-proportional calculation method. Money management lacks dynamic risk adjustment mechanisms such as ATR-based stop-loss distance or account-balance-adaptive position sizing. The overall strategy logic is clear but relatively simplistic, performing well in trending markets while potentially generating frequent false signals and consecutive losses in ranging conditions.
Strengths
- Simple and clear strategy logic, easy to understand and tune parameters
- ADX filters out weak-trend markets, reducing false signals in ranging conditions
- Combines both trend strength and direction dimensions for stricter entry conditions
- Applicable to multiple timeframes with good flexibility
- Relatively clean code structure, convenient for further development and optimization
Weaknesses
- Lacks dynamic stop-loss mechanism; fixed SL cannot adapt to market volatility changes
- No new bar check, potentially opening repeated positions on the same bar
- Missing spread filter, trading costs may be excessive in high-spread environments
- ADX is a lagging indicator, entry signals may be delayed causing missed optimal entries
- May still produce consecutive losses in ranging markets without market-regime adaptation
Possible improvements
- Add ATR-based dynamic stop-loss and take-profit to automatically adjust stop distances based on market volatility
- Implement new bar check and spread filter to prevent repeated position opening and high-cost trades
- Add position sizing module to dynamically calculate lot size based on account risk percentage
Risk assessment
Overall risk: Medium
- No new bar check may cause multiple position openings on the same bar leading to position overflow
- Fixed stop-loss of 0 may result in unlimited losses without a hard risk floor
- ADX lagging nature may cause entries at trend exhaustion points, increasing reversal risk
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
ADX_Period | 14 | ADX indicator calculation period |
ADX_Threshold | 25 | ADX trend strength threshold |
MA_Period | 20 | Moving average period |
MA_Method | MODE_SMA | Moving average method (SMA/EMA/SMMA/LWMA) |
LotSize | 0.1 | Fixed lot size per trade |
StopLoss | 0 | Stop loss in points, 0 means no stop loss |
TakeProfit | 0 | Take profit in points; close on cumulative profit |
MagicNumber | 12345 | Magic number; 0 to manage all orders |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.