Closing orders and opening one in other direction

 

Hi,

I'm coding an EA using pending orders. At a given time, I could have 2 or 3 buy orders opened and a pending sell order. The level where the pending sell order should be opened is used as a stoploss for all the opened buy orders.

The problem is that it tries to open the sell order before the buy orders are closed and it gives an error because hedging is not allowed.

Is there a solution for this problem?

 

Where's the code?


 
ubzen:

Where's the code?



There is no code.

I only want MT4 to first process all the orders to close and then open the order in the other direction.

Can we do that?

 
No. You'll have to program something to do that. You can check the code-base for something which may do what you want.
Reason: