Tâche terminée
Spécifications
I had some code converted from MT4 to MT5.
The main function of the EA is that when a certain level of floating drawdown is hit e.g. -$500, the total lot size of those positions are reduced by a specified level e.g. 40% and all the trades in that sequence are modified to breakeven. To achieve this I used the following function (OrderClose()), which also adjusts the trade comment to "to #Order Ticket" or "from #Order Ticket" (e.g. "to #197639979"). So what I have left after running these function is a bunch of trades at Break Even with a trade comment like "to #19639979". In addition to this I have a dynamic take profit function that takes the profit a specified symbol sequence (e.g. EURUSD sells).
After the floating loss has been triggered, I have a grid EA which may open new trades these new trades will have a certain comment and the modified orders will have a "to #19639979" comment. What I have been able to do is separate the take profit for the modified and unmodified orders by specifying a specific trade comment. This is because I take profit for all the orders apart from the following: StringSubstr(OrderComment(),0,4)!="to #" || StringSubstr(OrderComment(),0,4)!="from #".
Here is an explanatory video to demonstrate why this is important: https://drive.google.com/file/d/12IYFl5dcxLObdoQAEGJW10iIx4nVCwxw/view
############# REASON FOR REQUEST ####################### For MT5 it is not possible to modify the trade comment of an order, as a result the solution stated above does not work for it. What I need is a solution to identify the modified and unmodified orders without looking at a specific trade comment.
Please read this description, watch the video.
Code will then be provided.
Thanks