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
 
sir, i have downloaded and installed the mt5 script Close All Positions,
and now as my intial entry happen in my ea, sl is 20 in my ea, but i need to close the position as it reaches 10 pip in loss.
so how can i make it happen, as i dont see in default settings any pip parameter to put that 10 info.

plz guide on this.

1748066469517.png

1748066423320.png
 
Last edited:
sir, i have downloaded and installed the mt5 script Close All Positions,
and now as my intial entry happen in my ea, sl is 20 in my ea, but i need to close the position as it reaches 10 pip in loss.
so how can i make it happen, as i dont see in default settings any pip parameter to put that 10 info.

plz guide on this.

View attachment 32709

View attachment 32708
There is no such parameter. The script can only filter by losing/profitable.

Moreover, it doesn't look like this script is something that you need here. It would make more sense to have an EA that would be setting stop-loss on every trade to 10 pips. Something like this one for example:
https://www.earnforex.com/metatrader-expert-advisors/hidden-stop-loss-take-profit-ghost-sl-tp/
 
  • 👍
Reactions: oomeysh