Hi all,I have been playing with MQL4 for few months.One EA that I wrote reads a file, and based on the file content, it
opens, closes or modifes SL and TP.
So far I used an hardcoded magic number, and I used comments to match the ID in the file with the current trade.Today
I started playing with closng partial orders, and I noticed that it deletes the comments and writes "from #" and "to #" on the two parts of the
I was wondering what is the best way to track trades since comments cannot be used in this case. I could use magic numbers, which means that
every trade will have a different number.
The pro of this is that I can easily track partially closed trades.
The cons is that every trade will have a different magic number, which makes it hard to run multiple EAs on the same account. Plus the ID must be
I could keep the mapping in memory but if the EA restarted it would cause issues.Any suggestion on how to
approach it in the best way?
Not all brokers do that (most do not.) Not a good idea to use comments, brokers can change
comments, including complete replacement.
Find the highest ticket number, on the symbol, after a partial close. That is the new ticket number.