There is no such function
You have to go through the list of opened orders, save the ticket numbers in an array, sort the array and then you can have something like you want. It could be done similar to this :
for (int i=OrdersTotal()-1,i>=0, i--)
ordersByTicket[ArraySize(ordersByTicket)-1] = OrderTicket();
ordersByTicket == // last (biggest) ticket number and so on
TicketNumber = W[w]
Do you undestand??
I don't (understand)
If you know the exact ticket numbers you want to access, then simply use OrderSelect(ticketNumber,SELECT_BY_TICKET,MODE_TRADES); function
No! I don't know the ticket number :SWHat I want to do is the following:I speaking for the EA:"EA, close the first buy position!""EA, close the last sell position!""EA, close the three last position!""EA, close the last position and the 2nd of buy and 5nd of sell!"In other words, I want to control which position the EA will close by "1st", "2nd", ..., "penultimate" and "last".
Please enable the necessary setting in your browser, otherwise you will not be able to log in.