I have to confess that I was pretty excited last week when I learned about the release of the full metatrader 5 strategy tester. Being a fan of simulations to accurately model past trading I was dreaming about all the great enhancements that were now available and how all current Asirikuy systems would benefit from these implementations. This week I have been playing extensively with this new platform, mainly getting to know the MQL5 new programming language and all the "new ways" of doing things we must now relearn. I started by analyzing and understanding the sample experts released with the platform and later coded a few very simple systems to get to know the way in which things are done, indicators called, etc within this new trading program. On today's post I want to talk to you about my first "real exercise" which involved the porting of a preliminary version of Watukushay FE to metatrader 5. I will describe the process I went through, what I achieved and some of the things that surprised me when comparing results obtained with the Metatrader 4 backtester.
First of all, I have to say that coding experts for MQL4 has almost nothing to do with coding in MQL5. Almost everything is done differently and even though previous knowledge of MQL4 is useful, the truth is that several things like order placement, reading of indicator values, reading of bar values (high/low/open/close) and order selection are done differently. I found the approach implemented in MQL5 to be a little bit harder but yet a ton more flexible. This is particularly true of the new implementation of indicator and order handling which will now lend itself to an incredible coding flexibility. There are also some very useful functions included within the Trade.mqh file (downloaded with the platform) that will make EA programming a ton easier for those of you looking towards an "easier transition" from MQL4 to MQL5.
After familiarizing myself with the platform I decided to code the system that would be most easily available to all of you. Since Watukushay FE is the most widely used Asirikuy system -due to its free character- I decided to give the porting of Watukushay FE first priority. It is however important to say here that I did this porting merely as an exercise and it won't be the final release version of this EA for metatrader 5 which will probably take a few more months of polishing to develop (since we are currently developing a common MQL5 framework for Asirikuy systems taking advantage of the new classes implementation in this language). However the preliminary EA version I coded contains all the logic of Watukushay FE and follows the exact same logic as the MQL4 version in backtesting.
I have to say that I am amazed with the capabilities of Metatrader 5 regarding speed of execution. Simulations are not only fast but about an order of magnitude faster than in Metatrader 4. Watukushay FE runs a 10 year simulation in MQL4 in about 5 minutes while the Metatrader 5 implementation takes a little bit more than 30 seconds. Added to this absolutely great feature is the fact that multithreading is available for optimizations meaning that I can run a full 200 run optimization in less than half an hour when it previously took about half a day. Being able to run optimizations in parallel is a blessing and it will most likely open up the doors towards the finding of many profitable instruments and setups not currently used with Asirikuy systems. Below you can see an image of an optimization running on the 4 cores of one of my beloved quad processors.
--
You are probably also wondering how the Metatrader 5 backtesting results compare with the Metatrader 4 results and I would have to tell you that the results are a little bit puzzling to me. Watukushay FE is definitely long term profitable on both platforms but results are overall much better in Metatrader 5 when compared with the MQL4 version. The nature of this difference seems to be the difference between data sets. Since this version of Metatrader is new, we could assume that the data quality and interpolation mechanisms are better but such an assumption would have to be proved. Right now I am pleased to tell you that the EA - with the exact same settings - performs better on MQL5 and the Metatrader 5 data than on the Metatrader 4 version, meaning that -if anything- Watukushay FE is as good or better than what we think.
-
-
There is also a ton more of things to discuss regarding the optimizations of Watukushay FE and the new features and results available within the Strategy tester but for today I think that all the above information is enough :o). I have now started this series of posts called "The Metatrader 5 Series" which will deal with topics related to simulations, programming and overall features of this new Metatrader 5 platform which is bound to become the standard within the next few years in automated trading. During the next few weeks I will release several new posts on Metatrader 5 and probably Asirikuy members will also be able to enjoy a few videos on the matter :o)
If you would like to learn more about automated trading and how you can code your own likely long term profitable systems based on sound trading tactics please consider buying my ebook on automated trading or joining Asirikuy to receive all ebook purchase benefits, weekly updates, check the live accounts I am running with several expert advisors and get in the road towards long term success in the forex market using automated trading systems. I hope you enjoyed the article !
2 comments:
Hello Daniel,
Well, in a sentence: Welcome to the object oriented world!
It's a paradigm shift: MQL 4 is a procedural language, MQL 5: object oriented. I also disagree with Metaquotes that it's a C++ like language,-definitely not! C++ deals with memory management and other nasty issues, while .NET/Jave languages free developers from that.
It's also important to understand language constructs like access (private/protected/public), polymorphism (virtual functions). Once understood, these abilities will allow to reveal the language capabilities to their fulliest.
Maxim
Hello Maxim,
Thank you very much for your comment :o) It is definitely a paradigm shift and it will take me a while to get used to this form of coding. Definitely - as you say- this is NOT C++. Lets hope we'll be able to reveal the potential of this language to its fullest ! Thanks again for your email,
Best Regards,
Daniel
Post a Comment