The Quick Metatrader 4 vs Metatrader 5 Roundup 2018
About
Metaquotes has been trying for a couple of years to replace Metatrader 4 with the new and allegedly improved version 5. In this post, I will try to shed some light on the reasons why this has failed so far and how the two versions compare to one another now.
History
in 2009 Metatrader 5 was introduced by Metaquotes as the successor of the popular Metatrader 4 platform which has been the de facto standard for retail forex trading since 2005. While the graphical surface is much alike, MT5’s scripting language is very different.
Whereas MQL4 is allowing for rapid prototyping by procedural programming, making it rather beginner-friendly, MQL5 requires a more complex approach (handling of objects and references). What is a plus for the seasoned programmer, just adds another layer of complexity to the beginner for very limited added value.
As Metaquotes missed out on the opportunity to implement some kind of wrapper onto MQL5, granting backwards compatibility with MQL4, its huge codebase consisting of a vast number of free indicators and expert advisors was no longer usable. Making Metatrader 5 a very unattractive choice.
On top of that many popular and elementary features have been missing in Metatrader 5. You weren’t able to hedge, there was no option to import custom history data and you couldn’t create offline charts, which was particularly important to traders who rely on Renko Charts or want to use more exotic timeframes.
The points listed above are probably the main reasons why MT5 never really gained any traction and has been living in the shadow of its older sibling MT4 for almost 10 years now. However, as of version 1090 in 2017, Metaquotes won’t provide any further updates to MT4 and seems willing to really push its successor. This fact and the news that one of my favourite brokers Darwinex has now started offering MT5 accounts are reasons enough to take a deeper look into what has changed since the initial launch of MT5.
Metatrader 5 – Look under the Hood
My main reasons for not switching to MT5 where its lacking ability to import custom price data in tick format, its “no-hedge” rule and the fact that it hasn’t been adopted by many of my prefered brokers so far.
Since 2016 MT5 finally allows for a “hedging-option”, making its position management almost identical to MT4, which is essential if you are running a couple of expert advisors on one account. Since mid-2017 MT5 even allows the user to import custom price data in tick and bar form (look here on how to do it). As of 2018 Darwinex is offering MT5 accounts 🙂
So with no excuses left let’s take a look at MT5’s capabilities.
Backtester
One of its major improvements is the new backtester. It comes up with some new highlight features:
- Multithreaded Architecture
In MT4 the optimizer was only able to use one CPU core whereas MT5 will now utilize all available cores, giving it an enormous speed advantage during optimizations. - Distributed Computing
You can now make use of a network of so-called “agents” to perform input parameter optimizations. You have the choice to either use your own PCs or optimize within the Metaquotes cloud which is a cluster consisting of thousands of MT5 users who provide their computing power for a small fee. - Multi-Currency-Backtest
With Metatrader 5 there is the option to do backtests over multiple currency pairs, allowing for the creation of diversified portfolio expert advisors, or playing with Triangular-Arbitrage. - Detailed Reports
The backtest reports of MT5 are more detailed and include a breakdown of trades and profits by weekday and hours as well as holding times (Example). You can also get very in-depth reports from MT4 using the highly recommended Quantanalyzer. - Forward Test
You are now able to run backtests with user defined in- and out-of-sample periods.
- http://www.priceactionlab.com/Blog/2012/06/fooled-by-randomness-through-selection-bias/
- http://blog.darwinex.com/dos-donts-metatrader-4-backtesting/
Trading
- More Instruments (Stocks, Futures)
Metatrader 5 is technically able to also trade stocks and futures whereas Metatrader 4 was restricted to Forex trading. - “Depth of Market”
You can now also use the “Depth of Market” for trading. For Future trading, you can also look at “time & sales” data as well as “Tickcharts” with corresponding transactions (more info here). - Additional Order Types
MT5 introduces two new order types “Buy Stop Limit” and “Sell Stop Limit”. - Async Order Execution
Whereas with Metatrader 4 you had to wait for the trading server to confirm your first order before doing the next transaction, MT5 allows the user to send a batch of async orders without having to wait for the confirmation from the broker and handle potential errors afterwards. So if you wanted to close or modify dozens of orders at once, this will take considerably longer with MT4. The grid traders out there know what I am talking about 😉
Performance
We are only considering backtesting performance. These performance tests have been conducted with 1 year of Dukascopy Tickdata (2017) containing 21,641,732 unique ticks using Metatrader’s “Real Tick Mode”. I have been testing the “Moving Average” Expert Advisor that is included in every default Metatrader installation. I have also created an “MT4-style” version of the Moving Average Expert for Metatrader 5.
The local optimizations were running on a 4 core Virtual Machine and the Cloud Optimization on a Dual Xeon Server with a total of 28 cores.
Setup | Passes | Total Time | Time / Pass |
---|---|---|---|
MT4 Backtest | 1 | 27.547s | 27.547s |
MT5 Backtest | 1 | 21.406s | 21.406s |
MT5 Backtest (MT4 Style) | 1 | 26.890s | 26.890s |
MT4 Optimization | 36 | 11m 23s | 18.972s |
MT5 Optimization | 36 | 4m 11s | 6.972s |
MT5 Optimization (MT4 Style) | 36 | 5m 56s | 9.889s |
MT5 Optimization (Local Cloud) | 5000 | 1h 13m 48s | 0.922s |
Final Thoughts
Users running their Metatrader Terminal on a VPS with limited RAM and CPU power will have to consider that Metatrader 5 is more resource hungry than its ancestor. MT4 is said to have 1/3rd of MT5’s memory footprint. Though, the usage of resources is highly dependant on additional factors like opened charts, attached indicators etc. These numbers are to be expected as all those shiny new features and performance improvements come at a cost (comparable to new Windows Versions).
The documentation is pretty good and extensive as it already has been for MT4. With almost 9 years gone since its launch, there is also a decent amount of code examples (indicators, experts, scripts, etc.) available which should help to transition to version 5.
Rumour has it there will also be an API version of the Metaquotes economic calendar usable in MQL code, which would make news aware trading and backtesting a whole lot easier.
I am still not totally comfortable with MQL5’s rather clumsy order and indicator handling. While there do exist some unofficial wrappers, that are trying to provide MT5 compatibility with mql4 code, those wrappers are more of a hack than a serious alternative to mql5 though. They may or may not work depending on the complexity of your code and they most likely will impose some performance penalty. So converting your old MQL4 code will require some work, unfortunately.
While it has never been a big issue for me personally, as I have not been using offline charts extensively, there has been a lot of disappointment among many traders in MT5’s lacking ability to create offline charts. This used to be a good way to provide custom exotic timeframes or time-independent charts like Renko Bars. Coincidentally, since today there also is the possibility to create offline Renko Charts within MT5 using the Renko 2.0 Offline EA.
All in all, MT5 has come a long way since its launch and matured quite a bit. Give it another 9 years and it probably will have bumped MT4 completely 😉
very good article!
I think you missed one very import point in my opinion:
MT5 debug works on historical data and real data
MT4 only real data
it is much easier to develop code in MT5 and backtest it due to this
Good point. Thanks for bringing it up. I have not been using the debugger much, so I haven’t noticed that.
Stumbled upon your article while reading Darwinex. Very interesting comparative analysis.
Unfortunately, the code on MT5 is very cumbersome. It is very difficult to understand orders, deals and positions. You need to study object-oriented programming in order to use built-in libraries. It pushes away from the platform.
“I have also created an “MT4-style” version of the Moving Average Expert for Metatrader 5.”
What is this “MT4-style”? Where can I see your code in this “MT4-style”?
Glad you like the article. There is a library that tries to keep compatibility to MT4 style language as good as possible. Here is the link: https://www.mql5.com/de/code/16006 I used this library for the MT4-style Moving Average EA. Not sure if I still have the code though as it was just for this benchmark.
Thanks for the answer. I get a little writing the trading logic on MT4.
Could you share your experience in the form of a comment or article? Should anyone use this library or not? Is it possible that it does not work correctly?
IMO if you want to make the transition to MT5 you shouldn’t rely on a wrapper that tries to emulate MQL4. From my very limited experience with this class, it’s working okay but this wrapper naturally creates additional overhead (as seen in the speed comparison). I’d recommend getting used to the MQL5 StandardLibrary which isn’t that complicated actually (https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade).
After including the StandardLibrary CTrade class, sending a buy order is as easy as:
bool Buy(
double volume, // position volume
const string symbol=NULL, // symbol
double price=0.0, // execution price
double sl=0.0, // stop loss price
double tp=0.0, // take profit price
const string comment="" // comment
)
Thanks for the interesting review. Facts confirm that there are still more fans of the MT4 platform in the trader community than adherents of the newer MT5. I think this is not inertia or conservatism. In my opinion, it is difficult for practicing traders to abandon a large number of additional indicators, tools and extensions created for the MT4 platform and not supported by the new MT5 platform. In particular, I found one of the evidence for this here: https://thinkmobiles.com/blog/mt4vsmt5/. There are many similar opinions. I am not an expert, and I can’t say with confidence, but, according to most experts, one of the main reasons for this is the difference in the programming languages used in MT4 and MT5.