Some beginners have doubts when starting algorithmic trading. The main one is which programming language should be used to build what they want to.
If you decide to go in-depth, studying every single day the Meta Quotes Language (MQL) and start creating automated strategies and indicators, please ensure you stick around to know and learn the main differences between versions of MQL.
MQL solves many problems that involve discretionary trading. With these programming skills, you can write utilities to monitor the status of a trading account, mathematical calculations, trading alerts, and determine market buy or sell levels.
In the case of MetaTrader, it would seem logical to choose MQL5 over MQL4 because it is the newest, but there are some things that should be taken into account before deciding which one to choose.
In summary, later in this post, we will talk about those differences, advantages, and disadvantages and also which is the most popular by users. Then finally determine which is better to start developing strategies.
What are the differences between MQL4 and MQL5?
MetaTrader 5, the latest version of the software, runs excellently on 64-bit operating systems, while MetaTrader 4 is ideal for a 32-bit operating system. MT5 does not slow down the user’s computer.
One of the most important differences in the “non-hedge” rule established in MetaTrader 5 is users from the United States cannot open long and short positions at the same time. This rule gives a big disadvantage when using MQL5.
What does this mean? If you open a long position in one asset, you cannot open a short position in the same asset unless you close long.
Let’s see an example in the table below:
Although it is a difference between versions of MetaTrader, it also affects the programming of MQL robots because if you have two robots with different designs, configured to trade the same financial asset and at a certain time one robot open a long position, 30 minutes later, the other opens a short position, both orders will be canceled themselves. Why can this happen? Due to the non-hedge rule.
Basically, to create robots, there aren’t many differences. When we go in-depth into technical aspects of programming, there are different ways to carry out commands and edit them, but these details can be learned regardless of the version of MQL.
In MQL5, the way for submitting trading orders and the mechanism for responding have changed. Some functions in MQL4 were combined into a single command, making it simpler to program automated orders in MQL5.
Another difference is that versions are not compatible with each other. You should rewrite the code you already have in MQL4 to pass to MQL5, requiring time to configure it. This is one of the reasons why many traders decide to stay working with MetaTrader 4 coding in MQL4.
Let’s see in a comparative table with some other current differences:
|Time frames available||9||21|
|OpenCL and DirectX graphics tools||No||Yes|
MT4 is simple and easy to use, its interface is straightforward, and many traders love to use it, even though it is the oldest version.
Which is more popular?
Checking search statistics on google, we see that MQL4 has always been more popular over time, even after the release of MQL5.
It was from 2015 when the exponential growth of MQL5 began after different updates and improvements in MT5. This attracted the attention of new users.
At the beginning of 2020, MQL5 started to have more searches and positioned above the old version. Watch the screenshot above.
Where can you learn MQL4 and MQL5?
To study the programming languages, we recommend you to visit www.mql4.com about and www.mql5.com/en/about.
You will find there a full explanation of the language, helpful articles, different forums with frequently asked questions, strategies, and a bunch of indicators that can help you start in this exciting world of automated trading.
One of the best things about these websites is that you can buy bots tested by other traders that can often earn you money.
Programming languages are being increasingly used in day-to-day trading. This has motivated developers to improve code, including new functionalities that allow investors to work with automated strategies in a simpler way.
Since the creation of MQL4 (2005) until today, the community has been increasing to the point that you can work for others by applying your programming skills.
Talking about learning a new programming language can be a challenge, especially for those less experienced. Inside the community, you can create, test, and then sell indicators that could be helpful to other people.
The learning curve in MQL4 is much slower. However, the optimization strategy options are faster in MQL5.
Clearly, the latest versions of a language are designed to fix bugs, improve speed, and add new utility features. So, if you want to get the most actual knowledge in the market, it is better to select the latest version, but if you want to start learning the basics in a faster way, go for the first one.