MQL4 to MQL5

 

Hello, How can I write the following MQL4 condition to MQL5?

if (OrderSelect((IT_E2565O - 1), 0, 0) == true 
&& OrderMagicNumber() == MagicNumber && OrderType() != OP_BUY && OrderType() != OP_SELL);
 
Alireza Saadatinia: Hello, How can I write the following MQL4 condition to MQL5?

Its not so simple to convert directly. Your EA logic needs to be restructured because in the MT5 there are Orders, Positions and Deals and not just Orders like in MT4.

Articles

Orders, Positions and Deals in MetaTrader 5

MetaQuotes, 2011.02.01 16:13

Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
 
Alireza Saadatinia:

Hello, How can I write the following MQL4 condition to MQL5?

https://www.mql5.com/en/code/16006

MT4Orders
MT4Orders
  • www.mql5.com
Parallel use of the MetaTrader 4 and MetaTrader 5 order systems.