Libraries: MQL4 to MQL5 compatibility library

 

MQL4 to MQL5 compatibility library:

Short description.

Author: T-1000

 

Hello,

Unfortunately, your library is incomplete and bugged. I am trying to use your library with this mql4 indicator http://codebase.mql4.com/7472. I follow your instructions and I get 47 errors and 14 warnings.

'JJN-Fibo_with_compat_library.mq5'    JJN-Fibo_with_compat_library.mq5    1    1
'mql4compat.mqh'    mql4compat.mqh    1    1
'i' - undeclared identifier    JJN-Fibo_with_compat_library.mq5    150    8
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    175    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    176    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    177    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    178    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    179    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    180    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    181    4
'DisplayDec' - undeclared identifier    JJN-Fibo_with_compat_library.mq5    190    4
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    196    4
'DisplayDec' - undeclared identifier    JJN-Fibo_with_compat_library.mq5    197    100
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    197    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    197    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    198    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    199    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    199    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    200    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    201    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    201    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    202    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    203    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    203    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    204    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    205    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    205    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    206    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    207    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    207    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    208    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    209    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    209    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    214    4
'DisplayDec' - undeclared identifier    JJN-Fibo_with_compat_library.mq5    215    104
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    215    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    215    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    216    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    217    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    217    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    218    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    219    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    219    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    220    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    221    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    221    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    222    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    223    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    223    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    224    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    225    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    225    30
'ObjectCreate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    226    4
'StringConcatenate' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    227    30
implicit conversion from 'number' to 'string'    JJN-Fibo_with_compat_library.mq5    227    30
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    99    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    100    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    101    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    102    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    103    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    104    4
'ObjectDelete' - wrong parameters count    JJN-Fibo_with_compat_library.mq5    105    4
'return' - 'void' function returns a value    JJN-Fibo_with_compat_library.mq5    110    4
47 error(s), 14 warning(s)        48    15

 
angevoyageur:

Hello,

Unfortunately, your library is incomplete and bugged. I am trying to use your library with this mql4 indicator http://codebase.mql4.com/7472. I follow your instructions and I get 47 errors and 14 warnings.

The function names which are giving errors need to be adjusted by adding MQL4 in the end of their names so compilation erors will go away.

ALso I did test that indicator on MT4, seems it did not work properly there too.

P.S> I did some minor update and tweaks for compatibility library so you might grab latest version 1.1 as soon as it will be approved. In v1.0 the string StringConcatenate() function would not work properly as it conflicts between MQL4 and MQL5 in way how it works - added StringConcatenateMQL4 in v1.1
 
T-1000:
The function names which are giving errors need to be adjusted by adding MQL4 in the end of their names so compilation errors will go away.

ALso I did test that indicator on MT4, seems it did not work properly there too.

P.S> I did some minor update and tweaks for compatibility library so you might grab latest version 1.1 as soon as it will be approved. In v1.0 the string StringConcatenate() function would not work properly as it conflicts between MQL4 and MQL5 in way how it works - added StringConcatenateMQL4 in v1.1

Thanks for your reply. I will check when your version 1.1 will be available.

  • If a lot a function name need to be adjusted, it's no more a compatibility library, it would be better to adjust your library to suppress the 'MQL4' suffix. I know it's not possible for all function (StringConcatenate for example).
  • I suggest you to check this kind of code, as WHOLE_ARRAY is not intended to work with Copyxxxx function, and the result of this function is probably not what you wish.
void __Open(double &_Open[])
  {
   ArraySetAsSeries(_Open,true);
   CopyOpen(_Symbol,_Period,0,WHOLE_ARRAY,_Open);  // What is the returned value ?
  }
 

This library seems unmaintened in 2021. I tried contacting the author by sending him messages through MQL5, but no answer. I connected continiously to the mentionned IRC chan for more than a month, but I was alone this whole time... 

So I created a github version which fixes warning / errors when compiling with MQL5 version build 2981 as well as a very rough library which allows to run back a converted script / EA on MQL4.

So get the latest version here : https://github.com/eromawyn/mql4compat

And don’t hesitate to send me your patches if you did something interesting !

GitHub - eromawyn/mql4compat: MQL4 to MQL5 compatibility library
GitHub - eromawyn/mql4compat: MQL4 to MQL5 compatibility library
  • github.com
MQL4 to MQL5 compatibility library. Contribute to eromawyn/mql4compat development by creating an account on GitHub.