MT5 Python modify order

 

Hello , i hope someone can help me to modify an order in pyhton:

Symbol is : XAUUSD

when i modify the request i don't work

if order.retcode == mt5.TRADE_RETCODE_DONE:
    print(f"Order {order_ids} has been executed")
    takeprofit=1980.1
    modification_request = {
        "action": mt5.TRADE_ACTION_MODIFY,
        "order": order.order,
        "tp": takeprofit,
    }
    modification_result = mt5.order_send(modification_request)
    print(modification_result)

Output is following: 

  • Order [427721936] has been executed
  • OrderSendResult(retcode=10015, deal=0, order=0, volume=0.0, price=0.0, bid=0.0, ask=0.0, comment='Invalid price'

can someone please send me the part how to modify an order, should the TP be declared as float?

 

Call OrderCheck before sending an order and print out result and request - it'll tell you what's wrong — Documentation on MQL5: Python Integration / order_check

Documentation on MQL5: Python Integration / order_check
Documentation on MQL5: Python Integration / order_check
  • www.mql5.com
order_check - Python Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Carl Schreiber # :Call OrderCheck before sending an order and print out result and request - it'll tell you what's wrong — Documentation on MQL5: Python Integration / order_check

unfortunately that didn't help

Auto-translation applied by moderator

 
Please post in English. Either use the automatic translation tool, or post in one of the other language forums.
 
Fernando Carreiro #:
Please post in English. Either use the automatic translation tool, or post in one of the other language forums.

okey