OrderModify undeclared identifier

 

Hi everyone,

The include of the file Trade.mqh doesn't seem to be working for me (see picture include)... I still get the error 'OrderModify' - undeclared identifier

I've tried all there is in the picture joined (solutions).

Files:
include.PNG  27 kb
solutions.png  74 kb
 
Thomas Mainguy: The include of the file Trade.mqh doesn't seem to be working for me (see picture include)... I still get the error 'OrderModify' - undeclared identifier. I've tried all there is in the picture joined (solutions).

Regarding the image "solutions.png", I have no idea where you got that, but there is no OrderModify function in MQL5, only in MQL4.

There is however, an OrderModify CTrade class method, under the MQL5 Standard Library, but it has a different functionality to the function as used in MQL4.

MQL4:

OrderModify

Modification of characteristics of the previously opened or pending orders

Trade Functions

MQL5 Standard Library:

OrderModify

Modifies the pending order parameters

 
Thomas Mainguy: The include of the file Trade.mqh doesn't seem to be working for me (see picture include)... I still get the error 'OrderModify' - undeclared identifier.  I've tried all there is in the picture joined (solutions).

If you need help with your code, please show all relevant code usingthe CODE button (Alt-S). Don't show screenshots of code.

Code button in editor

Your topic has been moved to the section: Expert Advisors and Automated Trading — In the future, please consider which section is most appropriate for your query.
 
Thanks a lot Fernando Carreiro. Sorry for the misscategorisation and would you happen to know if we can modify an already open order in mql5?
 
By the way, if this is about generated code by ChatGPT, then please stop using it. It produces horrible code, mixing MQL4 and MQL5, which cannot be fixed.
 
Thomas Mainguy #: Thanks a lot Fernando Carreiro. Sorry for the misscategorisation and would you happen to know if we can modify an already open order in mql5?

Do you mean a Pending Order or do you mean a Position?

For a Position, ...

Yes! Either use the PositionModify method from the CTrade class or ...
... use the OrderSend function with the TRADE_ACTION_SLTP request action.

For a Pending Order, ...

Yes! Either use the  OrderModify method from the CTrade class (as already mentioned) or ...
... use the OrderSend function with the TRADE_ACTION_MODIFY request action.

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

Do you mean a Pending Order or do you mean a Position?

Thanks a lot that worked!

Reason: