MQL5 and working with Open Trades - page 2

 

OK one last question, sorry lol!

How do I obtain the Ticket ID of the newly created Trade (Position)?

I can see that MqlTradeResult does not have the related Ticket for the new position but it does have the 'order' and the 'deal'. Do I need to loop through and find a new one or can get it from the order ID within the MqlTradeResult object that is returned?

 
Noki0100 :

OK one last question, sorry lol!

How do I obtain the Ticket ID of the newly created Trade (Position)?

I can see that  MqlTradeResult does not have the related Ticket for the new position but it does have the 'order' and the 'deal'. Do I need to loop through and find a new one or can get it from the order ID within the MqlTradeResult object that is returned?

I use the following algorithm in my recent advisors (example for opening a BUY): I issue a trade order to open a BUY and check the result. If the result is 'true' and the trade server return code is correct, I raise the flag and wait for confirmation in OnTradeTransaction.

 
Great my code now works in some instances, you were very helpful!