Download MetaTrader 5

How to track partial closes

To add comments, please log in or register
Julie
11
Julie  

Dear all,

I'm puzzled with how to track partial closes in MT4 account history when multiple EAs are running on the same account, and more than one of them are doing partial closes. What I see in the comment field instead of the EA name is something like from '#24048391' or' to #24062061'.  Even though there is a number which I though was a reference to the original order, it turns out to be not. It's a vicious circle, and all trades with "to#number" lead to "from#number" and vice versa. Any ideas on how to recover the name of the original EA that placed the order? Thanks.

Julie 

qjol
3243
qjol  

comments are not reliable (it can be changed by the broker)

search the experts log

Keith Watford
Moderator
10033
Keith Watford  

You cannot recover the EA name, but you can recover the Magic Number, so use a different number for each EA and symbol.

The other way would be to code your EA to write to a file with details of the trade and WindowExpertName() whenever a trade is opened.

Carl Schreiber
6791
Carl Schreiber  

the reminding order has got a new ticket number (reference of your broker) which is not returned by a function other then the initial ticket number which is returned by OrderSend(..).

The magic number (your reference) remains.

So you have to search in the open order pool for magic number and Symbol() and a lot size that is smaller that the initial one by...?

Julie
11
Julie  
Great, thank you for the replies! Doing that via magic number turned out the easiest. 
To add comments, please log in or register