From MQL5 Standard Library to MQL4 Standard Library, backward compatibility issue

 

I'm compiling my "old" MT5 programs in the new MT4, however, some of them use many Standard Library files and now can't be compiled in MT4.

For example, the new MT4 Standard Library (Include Folder) doesn't have the Trade folder. Is this ok? Will this folder be incorporated soon?

Anyway, I'm manually copying the Trade folder from MT5 to MT4 and compiling it in MT4 -> Is this ok?

I've started with the file AccountInfo.mqh and get the following errors. ENUM_ACCOUNT_TRADE_MODE is not defined, etc.:

'ENUM_ACCOUNT_TRADE_MODE' - declaration without type AccountInfo.mqh 19 4
'ENUM_ACCOUNT_STOPOUT_MODE' - declaration without type AccountInfo.mqh 22 4
'ENUM_ACCOUNT_TRADE_MODE' - declaration without type AccountInfo.mqh 78 1
'ENUM_ACCOUNT_STOPOUT_MODE' - declaration without type AccountInfo.mqh 109 1
'TradeMode' - function not defined AccountInfo.mqh 89 11
'ACCOUNT_TRADE_MODE_DEMO' - undeclared identifier AccountInfo.mqh 91 12
'ACCOUNT_TRADE_MODE_DEMO' - constant expression required AccountInfo.mqh 91 12
'ACCOUNT_TRADE_MODE_CONTEST' - undeclared identifier AccountInfo.mqh 92 12
'ACCOUNT_TRADE_MODE_CONTEST' - constant expression required AccountInfo.mqh 92 12
'ACCOUNT_TRADE_MODE_REAL' - undeclared identifier AccountInfo.mqh 93 12
'ACCOUNT_TRADE_MODE_REAL' - constant expression required AccountInfo.mqh 93 12
'MarginMode' - function not defined AccountInfo.mqh 120 11
'ACCOUNT_STOPOUT_MODE_PERCENT' - undeclared identifier AccountInfo.mqh 122 12
'ACCOUNT_STOPOUT_MODE_PERCENT' - constant expression required AccountInfo.mqh 122 12
'ACCOUNT_STOPOUT_MODE_MONEY' - undeclared identifier AccountInfo.mqh 123 12
'ACCOUNT_STOPOUT_MODE_MONEY' - constant expression required AccountInfo.mqh 123 12
'OrderCalcProfit' - function not defined AccountInfo.mqh 275 8
'OrderCalcMargin' - function not defined AccountInfo.mqh 292 8
'OrderCalcMargin' - function not defined AccountInfo.mqh 327 8

19 error(s), 0 warning(s) 20 1


Thanks in advance.

 
laplacianlab:

I'm compiling my "old" MT5 programs in the new MT4, however, some of them use many Standard Library files and now can't be compiled in MT4.

Why ? the new mql4 is not mql5 . . .
 
RaptorUK:
Why ? the new mql4 is not mql5 . . .

I am not very clear about this..

I read this:

"MQL4 programming language has been completely revised and brought to the level of MQL5 - now you can develop trading robots in MQL4/5 using the unified MetaEditor development environment, single style, libraries and debugging tools".

"To achieve this, we have developed a unified compiler that automatically supports both MQL4 and MQL5 languages. MetaEditor will also become a unified application both for MetaTrader 4 and MetaTrader 5 platforms. Thus, it will be possible to compile both MQL4 and MQL5 from any version. MQL5 Storage also becomes available for work".

And it seemed to me that the Trade folder is missing in MT4.

Thank you.

 

MT4 and MT5 have different trade architectures. Therefore trade functions are different

For example both MT4 and MT5 written on the same C++. And compiled with the same MS Visual Studio compiler. But they are quite different trading platforms

 
stringo:

MT4 and MT5 have different trade architectures. Therefore trade functions are different

For example both MT4 and MT5 written on the same C++. And compiled with the same MS Visual Studio compiler. But they are quite different trading platforms


Thank you very much,

I'd like to know how I can take advantage of my MQL5 knowledge in those brokers which are still using MQL4.., just to know.

I see now... The Trade folder will remain "incompatible" because the old trading sytstem (allowing hedging, etc.) and the new one (single mode, only one operation) are different. Thks.

Reason: