Download MetaTrader 5

Question about trade retcodes

To add comments, please log in or register
Bogdan Caramalac
1112
Bogdan Caramalac  

I find that the documentation about the trade retcodes is a bit shallow, and I have some questions about some of them:

1. TRADE_RETCODE_REJECT - what are the reasons? is it an error? what is the difference versus the TRADE_RETCODE_INVALID and TRADE_RETCODE_ERROR ?

2. TRADE_RETCODE_CANCEL - when could it be considered that the trader decided to "cancel"?

3. What is the difference between PLACED and DONE ? Furthermore, what does it mean PARTIAL ? How could it be partial ?

4. Is TRADE_RETCODE_ORDER_CHANGED meaning an error, or is it a notification?

5. What does it mean TRADE_RETCODE_LOCKED ? 

Rogerio Figurelli
Moderator
43134
Rogerio Figurelli  
TheEconomist:

I find that the documentation about the trade retcodes is a bit shallow, and I have some questions about some of them:

1. TRADE_RETCODE_REJECT - what are the reasons? is it an error? what is the difference versus the TRADE_RETCODE_INVALID and TRADE_RETCODE_ERROR ?

2. TRADE_RETCODE_CANCEL - when could it be considered that the trader decided to "cancel"?

3. What is the difference between PLACED and DONE ? Furthermore, what does it mean PARTIAL ? How could it be partial ?

4. Is TRADE_RETCODE_ORDER_CHANGED meaning an error, or is it a notification?

5. What does it mean TRADE_RETCODE_LOCKED ? 

Hi TheEconomist, good point and questions, anyway I don't see a good and enough answer to all this return codes definition, since they are mainly regarded MT5 server side communications, that depends from several protocols third party implementations, i.e., know what return codes really impact the final positions depends on full system architecture knowledge (just my opinion).

Anyway, some doubts are deterministic answers, so I will focus on this.

For instance, PLACED is regarding Order Placed, i.e., your order was placed on the market in some way, and you can scan your positions to double check. 

Also DONE is regarding the order request, i.e., the request is done.

About PARTIAL, indicates that order volume was not fully executed, what depends on filling policy used. This is more usual in stock markets and low liquidity scenarios.

My suggestion to beware in any return case is anytime you get an undesirable return, try to investigate very well before sending a new order to the market. The best way I know to do this is right scan your positions after an OrderSend() (and this is really another hard work to do), since any result can impact in some way your expected positions.

Hope this information can help you in some way.

Alain Verleyen
Moderator
33337
Alain Verleyen  
figurelli:

Hi TheEconomist, good point and questions, anyway I don't see a good and enough answer to all this return codes definition, since they are mainly regarded MT5 server side communications, that depends from several protocols third party implementations, i.e., know what return codes really impact the final positions depends on full system architecture knowledge (just my opinion).

These are return codes from MT5, so I don't see how this can be related to any "third party implementation". Even if it's the case, it doesn't help as we don't know anything about MT5 server. By the way as I already said, it's very interesting questions. And I do agree it's very important to understand these return codes.

Anyway, some doubts are deterministic answers, so I will focus on this.

For instance, PLACED is regarding Order Placed, i.e., your order was placed on the market in some way, and you can scan your positions to double check. 

Also DONE is regarding the order request, i.e., the request is done.

I still doesn't understand the difference. If the request is done the order is placed, not ? And if an order is placed, isn't the request done ?

About PARTIAL, indicates that order volume was not fully executed, what depends on filling policy used. This is more usual in stock markets and low liquidity scenarios.

You are right. But I am still wondering if it's the only case where we can get an DONE_PARTIAL return code. Really not sure about that.

I already read that someone report his order (Forex !) are often filled with several deals, for example he sends an order to buy 1 lot and the request is executed in 3 deals (0.2, 0.5 and 0.3 lot), what will be the return code ? Each deal is a PARTIAL DONE but in the whole it's a FULL DONE. Unfortunately I didn't have occasion to check that.

My suggestion to beware in any return case is anytime you get an undesirable return, try to investigate very well before sending a new order to the market. The best way I know to do this is right scan your positions after an OrderSend() (and this is really another hard work to do), since any result can impact in some way your expected positions.

Hope this information can help you in some way.

Thank you.
Rogerio Figurelli
Moderator
43134
Rogerio Figurelli  
angevoyageur:
These are return codes from MT5, so I don't see how this can be related to any "third party implementation". Even if it's the case, it doesn't help as we don't know anything about MT5 server. By the way as I already said, it's very interesting questions. And I do agree it's very important to understand these return codes.
I still doesn't understand the difference. If the request is done the order is placed, not ? And if an order is placed, isn't the request done ?

You are right. But I am still wondering if it's the only case where we can get an DONE_PARTIAL return code. Really not sure about that.

I already read that someone report his order (Forex !) are often filled with several deals, for example he sends an order to buy 1 lot and the request is executed in 3 deals (0.2, 0.5 and 0.3 lot), what will be the return code ? Each deal is a PARTIAL DONE but in the whole it's a FULL DONE. Unfortunately I didn't have occasion to check that.

Thank you.
Note, I said more usual, not the only case. About the other points, just my point of view to help here, I prefer not to start a Moderators discussion about. Thanks.
To add comments, please log in or register