Spezifikation
Hello,
I have an existing MT5 Expert Advisor for XAUUSD. I need one specific protection feature added only.
Task:
Add a modular ON/OFF “Cumulative Drawdown From Peak” protection to my current EA.
Important:
Do not change the trading strategy.
Do not change entry logic.
Do not change exit logic.
Do not change EMA, ADX, session filter, Sell Hour Filter, lot sizing, SL/TP, BreakEven, or Trailing settings.
This job is only for adding the cumulative drawdown protection.
Required Inputs:
-
UseCumulativeDDProtection = true/false
-
CumulativeDD_MaxPercent = configurable percentage
-
CumulativeDD_Action = stop new entries only / close all bot positions and stop
-
ResetPeakMode = never reset / daily reset / manual reset if possible
Required Logic:
-
Track the highest account equity peak since the EA started or since reset.
-
Calculate current drawdown from that peak.
-
If drawdown from peak reaches the configured limit, the EA must block new trades.
-
Optional setting: close all bot-managed positions when the limit is reached.
-
The protection must affect only this EA’s trades if possible, using Magic Number.
-
The protection must be safe after MT5 restart. If possible, store/recover the equity peak using Global Variables or another reliable method.
Required Logs:
The EA must print clear logs such as:
-
CUM_DD_PEAK_UPDATED
-
CUM_DD_CURRENT
-
CUM_DD_LIMIT_HIT
-
CUM_DD_NEW_ENTRIES_BLOCKED
-
CUM_DD_POSITIONS_CLOSED
Deliverables:
-
Updated MQ5 file with a new version name:
EA_Trend_Advanced_v2_70_CumulativeDD_TEST.mq5 -
Updated MQH file only if necessary.
-
No unnecessary code rewrite.
-
A short explanation of every block of code changed.
-
Screenshot or confirmation that the EA compiles with 0 errors and 0 warnings.
-
The original v2.69 logic must remain unchanged except for this new protection feature.
I will provide the current EA files after accepting the developer.