You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm encountering unexpected behavior with the order_send function from the MetaTrader5 Python library. I believe this might be a bug.
Issue Description:
Python order_send function returns an OrderSendResult object analogous to the MQL5 MqlTradeResult structure, which includes the attributes:
retcode: Operation return code
comment: Broker comment related to the operation
The problem occurs specifically when the return code is 10006 (Request Rejected). In MQL5, when an order is rejected, the comment attribute correctly returns the broker-provided reason for rejection. However, in the Python version, the comment attribute erroneously replicates the original comment sent in the request, not the broker's rejection reason.
Here is the code to reproduce the issue:
The comment correctly indicates the reason for rejection provided by the broker:
Now the Python version (erroneous behavior):
Python function return the OrderSendResult object containing the original request comment instead of the broker-provided rejection reason.
Could the MetaTrader development team investigate this discrepancy? Am I doing something wrong?