Two MA Trend EA
- Experts
- Versione: 3.13
- Attivazioni: 10
Two MA Trend EA — trend-following Expert Advisor for MetaTrader 5, default settings configured for XAUUSD on the M15 timeframe.
At a glance
- Default chart: XAUUSD M15 — attach the EA and test as-is, no set file needed.
- Strategy Tester backtest with default settings (real ticks, 2021.01.01 – 2026.11.26, $10,000 deposit): 632 trades, profit factor 1.59, maximum equity drawdown 2.62%. Full details in the "Backtest results" section below; screenshots are on this page.
- Risk controls: fixed stop loss on every trade, optional equity guard (close all positions at a set equity drop), 24 hourly entry checkboxes plus weekday switches.
- No martingale, no grid. Optional pyramiding is OFF by default.
How it trades
The entry trigger is the price crossing the long moving average, confirmed by the alignment of the short and long moving averages. This is not a classic moving-average crossover system: the two averages do not need to cross each other — their relative position acts as a trend-state filter, and the price itself provides the entry trigger.
Entry logic (evaluated on closed bars only)
- Buy: the short MA is above the long MA, and the closing price crosses up through the long MA (previous close at or below the long MA, current close above it).
- Sell: the short MA is below the long MA, and the closing price crosses down through the long MA.
- An open position is closed when the opposite signal appears. A new position in the opposite direction is opened only by a later entry signal.
Optional filters (all can be switched off)
- Trend MA filter (e.g. EMA 200): buys only above the trend MA, sells only below.
- Trend distance filter: blocks entries when the price is too far from the trend MA.
- RSI filter with rising/falling confirmation.
- MACD filter with multi-bar confirmation.
- Bollinger Bands filter: breakout mode or minimum band width mode.
- Volume filter: relative to the average of N bars, spike vs the previous bar, or multi-window (any of the last X bars vs the average of Y bars).
Risk management — including prop-firm style controls
- Stop loss / take profit by percent of price, by ATR multiple, or by fixed points. Every position has a stop loss.
- Optional equity guard: closes all positions of this EA when equity drops by a set percentage from the starting or peak equity — use it as a hard daily/overall loss limit.
- Time filter with 24 hourly checkboxes and weekday switches (server time): disable entries at specific hours or on specific days (for example weekends or major news hours).
- Trailing stop (per tick or on bar close) and breakeven.
- Optional pyramiding: adds one extra position when the price moves against the entry by a set percentage (OFF by default).
- Lot size is normalized to the broker minimum/maximum/step; order filling mode is detected automatically.
Default settings
- The default parameters are configured for XAUUSD on the M15 timeframe: attach the EA to an XAUUSD M15 chart and it is ready to test as-is, no set file needed.
- Defaults include: SMA 9 / 21 with SMA 100 trend filter, trend distance filter, RSI filter, Bollinger Bands breakout filter, multi-window volume filter, breakeven and trailing stop.
Backtest results (Strategy Tester)
The screenshots show a Strategy Tester run with the EA's default settings - no optimization, no changed inputs:
- Symbol / timeframe: XAUUSD M15
- Period: 2021.01.01 - 2026.11.26
- Modelling: real ticks, history quality 98%
- Deposit: $10,000, leverage 1:100, fixed lot 0.01
- Total trades: 632 (394 long, 238 short), win rate 41.9%
- Profit factor: 1.59
- Net profit: $2,822
- Maximum equity drawdown: $318 (2.62% of the deposit)
- Recovery factor: 8.88
You can reproduce this test with the free demo: run the EA in the Strategy Tester on XAUUSD M15 with the default settings, real ticks, over the same period. Results on other brokers will differ because of feed, spread and swap differences.
These are backtest results on historical data, not real trading results. Past performance in the tester does not guarantee future results. Always test on your own broker's data and start with a demo account.
Notes
- Works on any symbol and timeframe; the EA trades the chart it is attached to. For other symbols/timeframes, re-optimize the parameters.
- Recommended: test in the Strategy Tester with real ticks and optimize on your own broker's data before live use.
- Additional example set files for XAUUSD H1 and ETHUSD M30 are available from the author on request. Past backtest results do not guarantee future performance.
