4 Objects Trade in the same EA ?

 

Hi everyone,

In the same I want to :
- Buy Limit( BuyLimit )
- Buy Market ( Buy  )
- Sell Limit ( BuyLimit  )
- Sell Market (  SellLimit )

Would you recommend creating 4 instantiations of the CTrade class? To better manage the different methods and avoid confusion?

What do you recommend? 


Best Reguards,
ZeroCafeine.

Documentation sur MQL5: Bibliothèque Standard / Classes pour le Trading / CTrade / BuyLimit
Documentation sur MQL5: Bibliothèque Standard / Classes pour le Trading / CTrade / BuyLimit
  • www.mql5.com
BuyLimit(double,double,const string,double,double,ENUM_ORDER_TYPE_TIME,datetime,const string) - CTrade - Classes pour le Trading - Bibliothèque Standard - Référence MQL5 - Référence sur le langage de trading algorithmique/automatisé pour MetaTrader 5
 
I recommend you try yourself before asking question.
 
Hi  Alain Verleyen

Thank you for your feedback, I've already tried it and I've got a code that runs very well, in which I use a single instantiation of the Class CTrade, 

for the moment I don't have any problems, but I'm wondering about the day when I'll have orders waiting to be opened that have been instantiated with an object and if at the same time I have to do something else with the same object, 

won't I get confused with the return codes of ResultRetcode() functions, for example?

Best Reguards 😊
 
I've just got my answer, you just need to get the ResultRetcode() codes right away.