Tips, Techniques and References for the conversion of MT4 into MT45

 

A thread dedicated to all future tips, techniques, references, advices, rules to convert metatrader 4 code to a "new" metatrader 4

It will be used as issues happen and become actual

______________________

Link to a latest beta version of "new" metatrader : MetaTrader4.Beta.IDE_1.zip

 

First of all : remove all "." (dots) from variable or function names. In the future they will be treated as errors (dot in an name is reserved for object orientated work - work with classes, and if they are not actual classes it will generate a compile error)

 

It would be good to have a link to the latest upgrade at the first post all the time

 

When making changes in your code, like removing dots, Backup before you start, keep generational Backup changes as you may need to return to a prior generation to correct unwanted changes.

Do not use expansive search and replace like changing "." to "_" as it is quite likely you will introduce unwanted changes. Incrementally change and then test.

Use SciTE as your editor as it has a "Save as Copy" under the Files. See MrTools thread on this software, also references to it by MLaden and Tzuman

Also a link to obtain this editor on the first message

 

Some other limitations and changes that have to be considered when the code is rewritten for the new metatrader 4

  • Changed the priority of AND/OR logical operations. Now, everything is similar to the standard C/C++
  • Introduced shortened evaluation of logical expressions. Now, when a logical expression is evaluated before reaching its end, the remaining subsequent expressions are not evaluated, like in C/C++.
  • Only integer values are now used in switch operator. Real values could have been used before
  • A dot symbol cannot be used in variable names any more. Also, '@', '$' and '?' symbols cannot be used in variable names
  • Tightened requirements for start function. Parameters could have been set in start function before. Now, all init, start, deinit, OnInit, OnStart, OnTick, OnTimer and other entry points should exactly match their signatures
  • Due to expansion of keywords, such names as short, long, float, const, virtual, input, delete, new, do, char cannot be used now
  • Now, imported dll functions cannot accept MQL string arrays as a parameter, like in MQL5
Reason: