Termos de Referência
I
I am looking for an experienced MQL5 developer to build a robust, fully automated Expert Advisor (EA) for MetaTrader 5 based on a moving average pullback strategy. The EA must be optimized for multi-symbol and multi-timeframe processing, capable of running on a single chart while scanning and trading a user-defined list of currency pairs.
1. Core Strategy Logic
* Trend Zone: The strategy utilizes the zone between the 10 EMA and 20 EMA. * Entry Trigger: The EA must monitor the close of each candle. It looks for a bar to move into or cross the 10/20 EMA zone and subsequently close outside of the zone in the direction of the current trend.
* Momentum/ATR Filter: Upon a valid entry trigger bar closing, the EA must calculate the value of the 10 EMA at that specific close. It must compare this value to the 10 EMA value from exactly 10 bars prior. - Condition: The trade is only taken if the absolute difference between these two EMA values is larger than the current ATR (14) value.
* Crossover Cooldown Filter: To avoid false signals during market whipsaws or immediate trend changes, the EA must not take any new trades within 5 bars of a 10 EMA and 20 EMA crossover event on that specific asset and timeframe. This lookback parameter (Crossover_Cooldown_Bars) must be adjustable in the settings.
2. Advanced Protection & Volatility Filters
* Large Bar Filter: To prevent entering trades with bloated, high-risk stop losses caused by news spikes or erratic market moves, the EA must feature an ATR-based candle size limit. If the total range (High to Low) of the entry trigger candle exceeds the current ATR multiplied by a user-defined threshold (Max_Candle_ATR_Multiplier, default 2.0), the setup must be completely ignored.
* Economic News Filter: The EA must utilize a reliable economic calendar (via MT5's native calendar functions or a reliable external WebRequest API like Forex Factory) to track high-impact news events relevant to the traded currency pairs. - Auto-Close & Pause Logic: The user must be able to specify a time window around major releases using Minutes_Before_News (to close active trades and pause new entries) and Minutes_After_News (to hold off new entries until volatility settles). - Toggle: A boolean switch to choose whether active trades are forcefully closed before the event, or if the EA should just pause taking new setups.
* Spread Protection: Must include a Max_Spread filter to prevent entries during high-slippage or high-spread environments.
3. Account & Weekend Protection Controls
* Max Daily Loss Limit: The EA must track the cumulative realized and unrealized net loss for the day (resetting at midnight server time). If the total equity drawdown for the day reaches or exceeds a user-defined percentage of the account balance (Max_Daily_Loss_Percent, e.g., 3.0%), the EA must immediately close all open trades, delete pending orders, and deactivate trading until the next trading day begins.
* Friday Session Auto-Close: To avoid weekend gap risk, the EA must feature an option to close all open positions and delete pending orders at a precise, user-defined server time on Fridays (e.g., Friday_Close_Hour = 21, Friday_Close_Minute = 30). No new trades should be initialized after this time until the market reopens.
4. Multi-Symbol & Multi-Timeframe Scanning
* The EA will sit on a single "Master" chart.
* Symbol Input: A string input allowing comma-separated pairs (e.g., EURUSD,GBPUSD,AUDUSD,USDJPY).
* Timeframe Toggles: Boolean inputs to independently enable/disable scanning for M15, H1, and H4 timeframes.
* Execution: Must use native MT5 multi-symbol data handling classes (CopyRates, CopyBuffer) to ensure fast, asynchronous scanning and execution without lagging the terminal.
5. Trade & Risk Management
* Dynamic Stop Loss (SL): Placed strictly at the value of the opposite side of the 20 EMA at the time of entry, plus a user-defined buffer in points.
* Money Management: Automatic lot sizing based on a user-defined percentage of account balance risk. The EA must calculate the distance between the entry price and the dynamic SL to determine the exact lot size down to the broker's decimal limits.
* Take Profit (TP) Modes: Must feature two selectable exit modes: - Mode 1 (Fixed R:R): Closes at a user-defined Risk-to-Reward ratio multiplier (e.g., 1:2). - Mode 2 (10 EMA Close): Closes the trade when a bar successfully closes back across the 10 EMA against the trade direction.
6. Graphic User Interface (GUI) Dashboard
* A clean, lightweight visual panel displayed on the chart screen showing a grid of the selected pairs and timeframes.
* The grid cells should change colour based on state (e.g., Green for Up-trend/Pullback, Red for Down-trend/Pullback, Gray for No Trend/Filtered/Cooldown/News/Max Loss).
* Interactive dashboard elements to toggle the TP Mode and modify the Risk % directly from the chart UI without reopening the properties menu.
7. Project Delivery Requirements
* Source Code: Delivery must include the fully commented, clean .mq5 source code file (not just the compiled .ex5).
* MT5 Strategy Tester Compatibility: The EA framework must be perfectly structured to pass multi-symbol backtesting in the MT5 Strategy Tester using "Every tick based on real ticks" across all specified pairs and timeframes concurrently. *Note: Please ensure the news filter bypasses blocking during historical backtesting if historical calendar data is unavailable.* * Robustness: No zero-divide errors or array-out-of-range errors under any circumstances. Proper error logging via Print() functions for broker execution errors.