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!
 
this is the setting i used, it did not close any order. But when i don't select any option, it closes

View attachment 32436
When you have both Close only positions in profit and Close only positions in loss set to true, it will ignore all positions because neither can be both in profit and in loss at the same time. If you want it to close positions regardless of profit/loss, you set both parameters to false.
 
1746276379350.png

If I want the default setting as "closing smaller profit/loss first", how to modify the script? i changed the script above but it still show No sorting