Closing Multiple orders in an EA

 
Please, my coding experience is limited. How do I close 5 or more open orders in an EA once they are all in profit? Is it possible for me to call a script from an EA? If yes, how? thank you.
 
zecomengineer:
Please, my coding experience is limited. How do I close 5 or more open orders in an EA once they are all in profit? Is it possible for me to call a script from an EA? If yes, how? thank you.
Just get the EA to close them one by one.
 
RaptorUK:
Just get the EA to close them one by one.



Yes, thank you, I thought of that; except, that the trades will be opened incrementally, that is, the first trade will be opened, when it is comfortably in profit, second trade will be opened and so on until we have five trades opened. Once the fifth trade is in profit, then all five trades are to be closed! Can any one help me with the codes to close the trades only when the fifth trade is in profit?
 
zecomengineer:


Yes, thank you, I thought of that; except, that the trades will be opened incrementally, that is, the first trade will be opened, when it is comfortably in profit, second trade will be opened and so on until we have five trades opened. Once the fifth trade is in profit, then all five trades are to be closed! Can any one help me with the codes to close the trades only when the fifth trade is in profit?
Loop through them one by one, when they all have OrderProfit() > 0 close them . . .
 
Okay, RaptorUK, I will do that and get back with the result. Thank you all
Reason: