Hi everyone. I' programming my own EA which opens a lot of positions on the same instrument. So far so good, but now I have trouble identifying which pairs belong together, I mean which closing position belongs to which opening position. I can add a comment when opening a position, but I can't find a way to add comment on a closing one. Do you know if this is possible at all. Much thanks in advance,
Best regards, Arcull
The ticket number is the individual reference of the broker for each position and the so called MagicNumber is your reference.
If you use them they will solve your problem.
Thanks Carl, I know that, I have no problem doing that in code, however I need that info on historical entries. Because I'm evaluating EA's work, and want to check manually if it did everything as it was meant. So I need to add that info somehow on closed entry. Is there a way to do that?
Thanks again, best regards
It is impossible to add comment to the orders at closing time of it. Comments can be added/included only at the openings of the orders.
If you want to collect some data for the order, like, what was the RSI and EMA values at the moment of order open, you may put these
values in the comment itself. Otherwise, no other-way can be done to modify the comment.
You may generate a new function that traces only closed orders and send the required info to it, but this could make things more complicated.
Thanks Osama. What about the comments that are filled on stop losses, I can see there something like "SL:1.1253". Are these comments filled by the broker's server? It would be great for my case to add comments on closing position, otherwise I have to do some other type of logging in a text file for instance.
Thank you for your help.
if MT5, you can add comment to close position.
other you can get Position ID from Deal ticket.
Hi Nguyen, I'm using MT5, please tell me how do I add comment on close position. Please paste the relevant part of MQL5 code.
Much thanks for your help.
i get code below from CTrade, i add code about comment. you can comment anything when EA close position.
but can not if postion hit TP/SL.