What's happened
"type" : action_type,
?
Where is the printout of the value before sending the order?
bergen288 # :
It’s either mt5.ORDER_TYPE_BUY or mt5.ORDER_TYPE_SELL depending on my condition. In my case above, it is Sell as confirmed by type=1.
It’s either mt5.ORDER_TYPE_BUY or mt5.ORDER_TYPE_SELL depending on my condition. In my case above, it is Sell as confirmed by type=1.
Read MQL5 Help - pending order != position
Add: OrderSend

Documentation on MQL5: Trade Functions / OrderSend
- www.mql5.com
OrderSend - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

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 am trying to place XAUUSD order with Python/MetaTrader5 combination in my demo account. When "action" is mt5.TRADE_ACTION_DEAL, it is a valid market order, but I am unhappy with large slippage. So I changed the action to mt5.TRADE_ACTION_PENDING to place limit SELL order with price + DEVIATION.
Unfortunately, order is failed with return code 10013 (invalid request). What do I miss in my request and how to fix it? Thanks.