Trades placed with CTrade returning always 0 for the Result variables

 
Hi,

I'm trying for the first time this class and followed  this guide https://www.mql5.com/en/articles/481 . Problem is that after placing the order I need to get the ticket because I'm trying to manage the operations by myself. The problem is that even the operation is placed and it has a ticket, a price, volume, etc. When asking this information it returns me 0.
Here the code and the print out.
if(trade.Buy(o.lots, o.orderSymbol)){
                     Print("Buy() method executed. Return code=",trade.ResultRetcode(),
                     ". Code description: ",trade.ResultRetcodeDescription(),
                     ". Deal Ticket: ", trade.ResultDeal(),
                     ". Order Ticket: ", trade.ResultOrder(),
                     ". Volume: ", trade.ResultVolume(),
                     ". Price: ", trade.ResultPrice());
}

Print:
2024.12.05 18:31:08.688 KSEA (CADCHF,H1)        Buy() method executed. Return code=10008. Code description: placed. Deal Ticket: 0. Order Ticket: 0. Volume: 0.0. Price: 0.0


Thank you.
Trade Operations in MQL5 - It's Easy
Trade Operations in MQL5 - It's Easy
  • www.mql5.com
Almost all traders come to market to make money but some traders also enjoy the process itself. However, it is not only manual trading that can provide you with an exciting experience. Automated trading systems development can also be quite absorbing. Creating a trading robot can be as interesting as reading a good mystery novel.
 
After some testing I found that it was because I was doing it asynchronous. So i guess it was printing the variables before the trade was set. The problem I find with this is that my script will have to wait to the position to be placed for it to keep managin the orders.
Is it a bad practice if I do it sinchronous? Is there any other solution?

Thank you.