Close All Positions Functionality
On MT4, each order needs be closed individually. So an EA that closes all orders, will iterate over each one to close it.
Remember that MT4 does not have positions like MT5 has. It only has Orders, be it pending orders or market orders.
EDIT: the best way to close out multiple orders in a way that "freezes" their gains (or losses) instantly, is by using the OrderCloseBy method. This method does not make closing the orders more quickly, but it does "freeze" the profit/loss, so that you can then take your time closing the orders without having to worry about the profit/loss changing while you are processing the orders. Run a search as there should be several threads about it.
- docs.mql4.com
ie if I have 10 seperate 0.1 lot orders open in EURUSD and use a close all script, does it send 1 order for 1.0 lots or 10 orders for 0.1 lot each to close each order individually?
If it is the later case sending individual orders, are they sent 1 at a time in order? Or is it possible to send all 10 orders simultaenously? I believe I have heard the term asnychronous order, but don't fully grasp what it actually does.
The reason I ask, I often utilize a grid style strategy, and therefore can end up with a large number of individual positions that I would like to try and close out all at once in the most efficient and quickest way possible.
Any help or opinions on the matter would be greatly appreciated! Thankyou!!