Welcome back, traders! Today, we're diving into a straightforward yet powerful trading strategy using moving averages in MetaTrader 4.
With this Expert Advisor (EA), you’ll be using two moving averages (MAs) to determine your buy and sell signals:
- Buy Signal: When MA 2 crosses above MA 35 – close any sell positions.
- Sell Signal: When MA 2 crosses below MA 35 – close any buy positions.
Your settings should look like this:
- Stop Loss (SL): 30 pips
- Take Profit (TP): 200 pips
- Trailing Stop (TS): 60 pips
Feel free to tweak the moving average parameters in the code to suit your trading style. Personally, I find exponential moving averages (EMAs) to be quite effective, which is what I exclusively use.
Happy trading!

Strategy Tester Report
MA_MA 2-35_EA
XM.COM-Demo (Build 509)
| Symbol | EURUSD (Euro vs US Dollar) | ||||
| Period | 4 Hours (H4) 2013.06.03 00:00 - 2014.02.19 23:59 | ||||
| Model | Open prices only (for automated strategies that directly control bar openings) | ||||
| Parameters | MagicNumber=10001; Lots=1; StopLoss=30; TakeProfit=300; TrailingStop=60; Slippage=3; | ||||
| Total Bars | 2113 | Ticks Used in Model | 3223 | Model Quality | n/a |
| Errors on Chart | 0 | ||||
| Initial Deposit | £10,000.00 | ||||
| Total Net Profit | £4,482.40 | Gross Profit | £13,169.40 | Gross Loss | -£8,687.00 |
| Profit Factor | 1.52 | Expected Payoff | £99.61 | ||
| Absolute Maximum Drawdown | £0.00 | Maximum Relative Drawdown | £3,550.80 (24.42%) | Relative Drawdown | 24.42% (3,550.80) |
| Total Trades | 45 | Short Positions (Winning %) | 23 (30.43%) | Long Positions (Winning %) | 22 (31.82%) |
| Winning Trades (% of Total) | 14 (31.11%) | Losing Trades (% of Total) | 31 (68.89%) | ||
| Largest | Winning Trade | £2,989.20 | Losing Trade | -£311.60 | |
| Average | Winning Trade | £940.67 | Losing Trade | -£280.23 | |
| Maximum | Consecutive Winning Trades (Profit in £) | 2 (£3,939.20) | Consecutive Losing Trades (Loss in £) | 8 (-£2,322.80) | |
| Maximum | Running Profit (Sum of Winning Trades) | £3,939.20 (2) | Running Loss (Sum of Losing Trades) | -£2,322.80 (8) | |
| Average | Consecutive Winning Trades | 1 | Consecutive Losing Trades | 3 | |
Comments 0