Close All Orders (Positions)

1720796382528.png
Hi, every time I use the hotkey to close all positions, this window pop-up. Is it possible to close all positions without poping-up this windows?
 
Hi admin, for example I want to close 10 orders and close immediately, not close order 1 2 3 4... each order a little late.
Even though I have changed the code DELAY = 0.
I see in MT5, Bulk Operation section select Close All Orders function, all orders will be closed immediately.
Admin please help me.
Thanks!

CLOSE ALL ORDER - 001.jpg
 
Hi admin, for example I want to close 10 orders and close immediately, not close order 1 2 3 4... each order a little late.
Even though I have changed the code DELAY = 0.
I see in MT5, Bulk Operation section select Close All Orders function, all orders will be closed immediately.
Admin please help me.
Thanks!

View attachment 32234
You'd need to use the asynchronous mode to replicate the Bulk Operation closing procedure.
Just add this line anywhere after Trade = new CTrade; in the code:
MQL5:
Trade.SetAsyncMode(true);
The problem is, there is no way to ensure that the closing went through in the async mode. If the close order is rejected for some reason, you will know about it only after the script has already finished executing.
 
  • 👍
Reactions: Andy1946
You'd need to use the asynchronous mode to replicate the Bulk Operation closing procedure.
Just add this line anywhere after Trade = new CTrade; in the code:
MQL5:
Trade.SetAsyncMode(true);
The problem is, there is no way to ensure that the closing went through in the async mode. If the close order is rejected for some reason, you will know about it only after the script has already finished executing.
Thanks!