How do I to close all orders limit ?
Your orders are still pending orders, so you can't use PositionXXX() functions. There is no such thing as a position limit.
Your closeAllOrdersLimit() doesn't work because it's bugged. OrderGetTicket() requires an index (so x in your case), not ORDER_TICKET.
Please read the documentation.
I have getting an issue that I cannot solve. The problem is that I am opening 2 orders as limit but I can't close it. I tried to use OrdersTotal() and PositionsTotal() to get the tickets and then try to close but it just doesn't works and I don't know why.
How could I do this ?
Trying
ClosingPositions
ClosingOrders