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.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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