All order close

 
Hello 

I want to close all order programmatically with one magic no but not using loop
I want to close all order at same time not one by one

Please help me if this is possible 

Thank you in advance 
 
NIKHIL RELAN: I want to close all order programmatically with one magic no but not using loop. I want to close all order at same time not one by one. Please help me if this is possible 

Not possible! You have to use "loop". You can however use the "Close By" method to "freeze" the gains before carrying out the "loop", but only if the broker allows using this method.

OrderCloseBy

Closes an opened order by another opposite opened order

OrderCloseBy - Trade Functions - MQL4 Reference
OrderCloseBy - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderCloseBy - Trade Functions - MQL4 Reference
 
NIKHIL RELAN:
Hello 

I want to close all order programmatically with one magic no but not using loop
I want to close all order at same time not one by one

Please help me if this is possible 

Thank you in advance 

Doable, but quite difficult.

From one EA you can only send one trade request at a time.

But, from MULTIPLE EAs you can send MULTIPLE requests at the same time.

So, you need to deploy an army of EAs, being managed by one Master EA, build a communication between them based on CHART_EVENT_CUSTOM and make them sending all your closing requests at the same moment.

:)))

 
Andrey Barinov #: Doable, but quite difficult. From one EA you can only send one trade request at a time. But, from MULTIPLE EAs you can send MULTIPLE requests at the same time. So, you need to deploy an army of EAs, being managed by one Master EA, build a communication between them based on CHART_EVENT_CUSTOM and make them sending all your closing requests at the same moment. :)))
Technically incorrect. On MT4, the Order Transactions are still processed synchronously, even if using multiple EAs.
 
Fernando Carreiro #:
Technically incorrect. On MT4, the Order Transactions are still processed synchronously, even if using multiple EAs.
Please, elaborate.

What I am saying, is that you can send multiple trade requests at the same time, not one by one when you need to wait for the previous one being executed before sending another one.

And this is correct, because I have done that.
 
Andrey Barinov #: Please, elaborate. What I am saying, is that you can send multiple trade requests at the same time, not one by one when you need to wait for the previous one being executed before sending another one. And this is correct, because I have done that.
The EAs may send multiple requests, but the terminal will still process them individually. MT4 does not support asynchronous requests.
 
Fernando Carreiro #:
The EAs may send multiple requests, but the terminal will still process them individually. MT4 does not support asynchronous requests.
It is better if someone from MQ comment on it, but I remember hearing something about 8 trade requests processed at the same time in MT4.

There was even a product published in the market to do that. I remember the author of it, but the product is not online now.
 
Actually it t is quite easy to check. But need open markets:)
 
Andrey Barinov #: It is better if someone from MQ comment on it, but I remember hearing something about 8 trade requests processed at the same time in MT4. There was even a product published in the market to do that. I remember the author of it, but the product is not online now. Actually it t is quite easy to check. But need open markets:)

Even if I am wrong, it is not worth the extra effort, because the CloseBy method will always "lock" the gains much more quickly and is much easier to implement.

At the speed of a single transaction (the reverse order), the gains are locked, and then all the individual trades can be closed with OrderCloseBy at a leisurely pace.

OrderCloseBy - Trade Functions - MQL4 Reference
OrderCloseBy - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderCloseBy - Trade Functions - MQL4 Reference
Reason: