Develop an automated Expert Advisor (EA) for MetaTrader 5 based on EMA crossover signals combined with strict risk management and trade management principles.
The EA must be optimized for Forex pairs and indices and should operate automatically without manual intervention.
Fast EMA crosses above Slow EMA.
Current candle closes above both EMAs.
Trend confirmation:
Price must be above the 200 EMA.
Spread must be below user-defined maximum spread.
No existing buy position on the same symbol.
Execute Buy Order at market price after candle close.
Fast EMA crosses below Slow EMA.
Current candle closes below both EMAs.
Trend confirmation:
Price must be below the 200 EMA.
Spread must be below user-defined maximum spread.
No existing sell position on the same symbol.
Execute Sell Order at market price after candle close.
User Inputs:
Fast EMA (Default: 20)
Slow EMA (Default: 50)
Trend EMA (Default: 200)
All EMA values must be adjustable from inputs.
Select one of:
Fixed Lot Size
Risk Percentage per Trade
Inputs:
Fixed Lot = 0.10
Risk % = 1%
Risk-based lot calculation should use stop-loss distance.
User can choose:
ATR Based Stop Loss
Fixed Pip Stop Loss
Default:
ATR Period = 14
ATR Multiplier = 2.0
Alternative:
Fixed Stop Loss = 30 Pips
User can choose:
Fixed Risk Reward
Dynamic Exit
Default:
Risk Reward Ratio = 1:2
Example:
30 Pip SL
60 Pip TP
When trade reaches:
+1R Profit
Move stop loss to entry price.
Optional Enable/Disable
Inputs:
Trailing Start = 1.5R
Trailing Distance = 1R
Enable/Disable
Available Sessions:
London
New York
London/New York Overlap
Disable trading:
30 minutes before high-impact news
30 minutes after high-impact news
Currencies:
USD
EUR
GBP
JPY
CAD
AUD
NZD
CHF
Default:
3% Account Equity
If reached:
Stop trading for the day.
Default:
3 Trades
If reached:
No further trades.
User-defined magic number.
EA should work on:
EURUSD
GBPUSD
USDJPY
AUDUSD
XAUUSD
NAS100
US30
Display:
Account Balance
Account Equity
Daily Profit/Loss
Current Spread
Open Trades
Risk per Trade
Send alerts through:
MT5 Notification
On-screen Alert
Events:
New Trade Opened
Trade Closed
Daily Loss Limit Reached
EA must be:
Fully compatible with MT5
Backtestable in Strategy Tester
Optimized for speed and low CPU usage
Written in clean, documented MQL5 code
Free from duplicate trade entries
Source Code (.mq5)
Compiled File (.ex5)
User Manual
Input Settings Guide
Backtest Report Example