Single post

Moving from MQL4 to MQL5

Summary: This article will explain the differences between MQL4 and MQL5.

MQL5 is the latest programming language that is written in numerous scripts, Expert Advisor and indicators. Here are some main differences between MQL5 and MQL4.

MQL5 does not contain functions such as init(), deinit() and start(). Besides that, this language has unlimited number of indicator buffers. It has local variables and the language suggests implicit type cast. It also deletes all common local arrays by default.

For MQL5, it has the word ‘On’ in front of each function. OnInit and OnDeinit are meant to identify the code for initialization and de-initialization. OnStart is usually being used at the beginning of a script.

In MQL5, the predefined variables and access to time series are also slightly different from MQL4. Although there are unlimited numbers of buffers for MQL5, each of the buffers requires a selected location as part of the memory in the terminal.

Another main difference is the number of drawings. MQL5 has more drawing styles and the philosophy also alters drastically from those in MQL4.

Although there are lots of changes, SetIndexBuffer is the only indicator that remains unchanged. However, the call has changed by indicating the type of information to be stored and connect it to the indicator buffer.

There are lots of changes moving from MQL4 to MQL5. All of these changes actually help you to make the program much easier to understand and use. It also includes more functions to help out programmers.

theme by teslathemes