Specification
I am looking for an experienced MQL5 developer to research, develop, and integrate a Smart Early Exit system into my existing XAUUSD EA.
The EA is already fully functional. The objective of this job is not to redesign the strategy or modify the entry logic, but to improve how losing trades are managed.
The Early Exit system should identify trades that are showing signs of genuine deterioration and close them before they reach the full Stop Loss, while avoiding unnecessary closure of trades that are temporarily negative but could still recover.
Current Baseline Performance
Backtest period: 01/01/2025 – 31/08/2026
- Profit Factor: 1.42
- Total Trades: 2,820
- Average Win Rate: ~88%
- Recovery Factor: 3.78
- Biggest Losing Trade:-12 164.45
- Biggest Winning Trade:
5 990.00
The developer will receive the original EA and the baseline backtest/settings used for comparison.
Main Objective
Develop an Early Exit system focused specifically on reducing the impact of losing trades.
The system should distinguish, as much as reasonably possible, between:
- Normal temporary drawdown that later recovers
- Genuine trade deterioration that is likely to result in a large loss or full Stop Loss
Possible approaches may include market structure, adverse price movement, volatility/ATR, momentum deterioration, trend deterioration, time in trade, MAE/MFE analysis, or a combination of limited and explainable conditions.
I am open to the developer proposing the most appropriate approach after analyzing the EA and its trade behaviour.
Performance Targets
After implementation, the target is:
- Profit Factor: ≥ 1.58
- Recovery Factor: ≥ 3.80
- Win Rate: 75–80% is acceptable
- Reduce the biggest losing trade by approximately 10–20%
- Preserve the biggest winning trade as much as possible
- Avoid materially increasing Drawdown
- Avoid excessive reduction in trade frequency
These figures should be treated as optimization/validation targets rather than achieved by simply over-optimizing the backtest.
Important Restrictions
The following parts of the EA should remain unchanged unless explicitly agreed:
- Entry logic
- BUY/SELL entry conditions
- Trading sessions
- Core strategy logic
The work should focus on trade management and Early Exit logic only.
The Early Exit should primarily affect trades that are already in loss or showing clear deterioration. Profitable trades should not be unnecessarily closed by the new system.
Validation
I want the developer to compare the original EA against the modified EA using the same historical period and settings.
I also prefer the final solution to be validated on Out-of-Sample data or another reasonable validation method to reduce the risk of overfitting.
The final delivery should include:
- Modified MQL5 source code
- Early Exit parameters/settings
- Explanation of the implemented Early Exit logic
- Before/after backtest comparison
- Profit Factor
- Recovery Factor
- Win Rate
- Total Trades
- Maximum Drawdown
- Biggest Winning Trade
- Biggest Losing Trade
- Number/percentage of trades closed by the Early Exit system