Proper (better) way to add an order - (MQL5)

 

Good morning, I have an EA that I created and have been using it for the past year but now I'm trying to make it "better" and one of the things that I need to do is find a better way to add orders.

Today, I use the MqlTradeRequest and MqlTradeResult so I can add order, but by using that, sometimes a few errors can happen (like if I put the order and then the price changes, or if I check the volume, put the order but then the volume decreases, or connection errors).

I'd like to know if there's a "proper" way (or better way) to add orders.

Thanks in advance...

 
LucasHeise:

Good morning, I have an EA that I created and have been using it for the past year but now I'm trying to make it "better" and one of the things that I need to do is find a better way to add orders.

Today, I use the MqlTradeRequest and MqlTradeResult so I can add order, but by using that, sometimes a few errors can happen (like if I put the order and then the price changes, or if I check the volume, put the order but then the volume decreases, or connection errors).

I'd like to know if there's a "proper" way (or better way) to add orders.

Thanks in advance...

https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade

 
Mark Watkins:

https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade

Hey, thanks for your reply, could you show a example for a order with some callback errors please? If not, that's ok. Thanks again...

Reason: