Download MetaTrader 5

Closing Multiple orders in an EA

To add comments, please log in or register
Olusegun Oluwatimilehin
181
Olusegun Oluwatimilehin  
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.
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
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.
whroeder1
17109
whroeder1  
Olusegun Oluwatimilehin
181
Olusegun Oluwatimilehin  
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?
Simon Gniadkowski
Moderator
18056
Simon Gniadkowski  
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 . . .
Olusegun Oluwatimilehin
181
Olusegun Oluwatimilehin  
Okay, RaptorUK, I will do that and get back with the result. Thank you all
To add comments, please log in or register