Immediate pending order closure
-
A question for all skilled visitors to this forum;
is there a block or a costum code to close all pending orders almost immediately?
My EA sometimes has over 200 open pends and when it closes in profit it must immediately close the countless open pends (over 200).
Thanks to those who will be able to help me.I am attaching a code that I have worked out, but it is not as fast as I would like.
-
@bigape In the on trade tab add these blocks, and this should be what happens.

-
@jstap
Many thanks for your reply; your code is correct, and it's work.But the problem remains of the slowness with which pending orders are closed.
This is because Metatrader closes them using a chronological time sequence.
It would be interesting to see if it is possible to create a code that closes everything immediately ....
-
@bigape You can try the pink blocks, for each pending order > close, it says it closes immediately, so may loop from 1 to the next and close quickly, give it a shot.
-
@jstap
Many thanks; ... good idea.
I'll try it.I'll let you know.
-
@bigape Ok
-
@bigape your not dealing with anything except the speed of your mt4 server. but also i have only seen active trade close immeditatly . non active trades have to be closed 1 after another
-
@youngtreptrader
Thanks; I figured it was like that