Help needed: Implementing native MT5 "Close all positions" functionality in EA
I'm working on a Stream Deck Controller EA and I need help improving my CloseAllPositions function.
I'd like to replicate the native MT5 bulk operation "Close All Positions" (the one accessible via right-click -> bulk operations -> Close all positions) as it's much more efficient than my current implementation.
Here's my current code:
This is what I could do by taking a look at the documentation. It's just a loop through all the positions, they get closed them one by one.
The native function in mt5 is just superior, it seems like all positions get closed all at once. Any idea?
You can find new ways if you will read this article: https://www.mql5.com/en/docs/trading/ordersendasync
+ Also this: https://www.mql5.com/en/docs/constants/tradingconstants/enum_trade_request_actions
- www.mql5.com
I'm working on a Stream Deck Controller EA and I need help improving my CloseAllPositions function.
I'd like to replicate the native MT5 bulk operation "Close All Positions" (the one accessible via right-click -> bulk operations -> Close all positions) as it's much more efficient than my current implementation.
Here's my current code:
This is what I could do by taking a look at the documentation. It's just a loop through all the positions, they get closed them one by one.
The native function in mt5 is just superior, it seems like all positions get closed all at once. Any idea?