Diff_TF_MA_EA
This EA trades based on the difference between moving averages from two different timeframes. It compares the MA values from a higher and a lower timeframe to generate buy and sell signals when the differential crosses threshold levels. The strategy aims to capture trend alignment across multiple timeframes for higher-probability entries.
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 | +1.62% | +1.40% | 2.02% | 78 | 56.40% | 0.50 | 0.80 | 4 | +$2.07 | Reliable |
| GBPUSD | +0.18% | +0.16% | 4.22% | 84 | 47.60% | 0.06 | 0.04 | 14 | +$0.22 | Reliable |
| USDJPY | +0.78% | +0.68% | 4.14% | 82 | 48.80% | 0.21 | 0.19 | 5 | +$0.95 | Reliable |
| XAUUSD | -10.49% | -8.75% | 57.31% | 78 | 57.70% | 0.23 | -0.18 | 3 | −$13.45 | Reliable |
Profitable on 3 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 Multi-Timeframe EAs with a reliable result on the same market: EURUSD: better than 64% of 11 · GBPUSD: better than 58% of 12 · USDJPY: better than 33% of 12 · XAUUSD: better than 42% of 12
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +2.02% 2026-04 | -1.04% 2026-03 |
| GBPUSD | 54% | +2.26% 2026-07 | -2.15% 2026-10 |
| USDJPY | 38% | +2.33% 2026-04 | -1.96% 2026-03 |
| XAUUSD | 46% | +60.54% 2026-04 | -35.00% 2026-02 |
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 of this EA utilizes the difference between moving averages from two different timeframes to determine market trend direction. Entry conditions are triggered when the differential between the fast-timeframe MA and slow-timeframe MA exceeds a user-defined threshold: a positive and increasing differential generates buy signals while a negative and decreasing differential generates sell signals. Exit conditions rely on reverse signal triggers or stop-loss and take-profit settings. Position sizing allows the user to specify a fixed lot size, but there is no dynamic position sizing or equity-proportional lot calculation mechanism. Money management is relatively basic, primarily relying on stop-loss and take-profit parameters to control per-trade risk. The overall strategy logic is straightforward, and the multi-timeframe alignment approach helps filter false signals, but it lacks consideration for market volatility and trading costs such as spread.
Strengths
- Multi-timeframe analysis approach is sound, effectively filtering single-timeframe false signals
- Strategy logic is concise and clear, parameters are intuitive and easy to understand and optimize
- Using MA differential rather than simple crossover provides a finer measure of trend strength
- Supports customizable timeframes and MA periods, offering good flexibility
Weaknesses
- Fixed lot sizing lacks dynamic position management, unable to automatically adjust risk exposure based on account equity
- Does not account for spread and slippage impact on trading costs, which may erode profits in short-term operations
- No new bar check mechanism, potentially opening repeated positions on the same bar
- Lacks adaptability to market volatility (e.g., ATR), thresholds may become ineffective under different market conditions
- Stop-loss and take-profit use fixed pip values, not considering volatility differences across currency pairs
Possible improvements
- Add ATR-based dynamic differential threshold and stop-loss/take-profit to adapt to varying market volatility conditions
- Implement new bar check and position check logic to prevent repeated entries and over-trading
- Introduce equity-proportional dynamic position sizing for more scientifically grounded money management
Risk assessment
Overall risk: Medium
- Lack of new bar check may cause repeated position opening on the same bar, leading to overexposure
- Fixed stop-loss and take-profit do not adapt to different market volatility environments, potentially causing frequent stop-outs or overly distant targets
- No spread filter means trading costs are uncontrolled on pairs or sessions with wide spreads
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Fast_Timeframe | M15 | Fast timeframe |
Slow_Timeframe | H4 | Slow timeframe |
Fast_MA_Period | 14 | Fast MA period |
Slow_MA_Period | 50 | Slow MA period |
MA_Method | MODE_SMA | MAcalculation method |
Diff_Threshold | 0.001 | Difference threshold; minimum spread to trigger trade |
Lot_Size | 0.1 | Fixed trading lot size |
Stop_Loss | 500 | Stop loss in points |
Take_Profit | 1000 | Take profit in points |
MA_Applied_Price | PRICE_CLOSE | MA applied price type |
Similar Multi-Timeframe EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.