Metatrader 4/5 Simulations : Our Intention to Move Beyond

Through the past year I have been coding a lot of systems and projects within Metatrader 4 and to some degree Metatrader 5. Along this journey it has become clear that there are many inherent limitations to the Metatrader 4 and 5 testers which limit the amount of things that can be done and which put important limitations on the speed and extent of system evaluations. Although I consider these platforms great to use for the execution of strategies (at least when talking about the needs of my systems) it is clear that the evaluation of trading strategies is awfully limited and a better solution is needed to evaluate and speed up testing. On today’s post I will write about the short comings of the Metatrader 4/5 platforms, how they limit our testing potential and what we intend to do within the Asirikuy community to overcome these hurdles.

When you develop automated trading strategies you want to be able to do certain things which are simply impossible to do in Metatrader 4 and only partially solved in Metatrader 5. Certainly Metatrader 5 marks a significant improvement over 4 regarding several aspects, particularly the enabling of Portfolio evaluations, the inclusion of better tick interpolation algorithms, the change to a faster tester, multi-threaded support, etc. However there are still many problems within both platforms that seriously limit our ability to develop trading systems beyond what has already been done in Asirikuy.

The first barrier is perhaps the fact that we do not know what is behind the curtains in MT4 and MT5. When you are dealing with “closed source” solutions it becomes impossible to see what the program is doing when running the tests and if any of the assumptions the program is taking hinder the accuracy of your tests. It therefore become impossible to know how the interpolation algorithms are affecting trading results, how the program is calculating the amount of money per lot size traded, etc. Things like not being able to set the spreads (you cannot set them in either 4 or 5) and having to come up with “hacking solutions” like my spreadchanger program, are less than ideal when dealing with a strategy testing platform.

Another great problem – only partially solved in MT5 – is the speed of the tests. Metatrader 4 is perhaps one of the slowest testing platforms available and even though MT5 improves this testing speed dramatically it is still well below what can be achieved through the use of an independent tester. A C++ tester running only on 1 minute OHLC data can run a few thousand tests every ten minutes over a 10 year period without any problems, way beyond what either MT4 or MT5 can achieve within this time frame. Of course why the MT4 and 5 testers are so “slow” is beyond what we can tell since – like I said above – we cannot look at the program’s source or what makes it inefficient in this regard.

Another problem here is the optimization code which is “hard-coded” into both MT4 and MT5. When developing systems for portfolios and especially when developing systems based on a genetic framework it becomes very important to know how optimizations are being carried out since the outcomes depend on the way in which these optimizations are done. This means that in MT4 and MT5 we cannot alter the way in which the optimizations are done something that inherently limits our ability to evaluate strategies and to arrive at better results since we cannot alter things which are bound to be important (like initial population sizes in genetic algorithms, etc).

Other problems of these platforms are also clear like the use of tests where the quote and deposit currencies do not match. For example running a EUR account on a USD/CHF test implies that the strategy tester will use the latest EUR/USD and EUR/CHF quotes to obtain the value per pip, something which is very unrealistic when you consider that the exchange rate for the past 10-20 years has been more than dynamic. This leaves you with a test that is potentially very inaccurate regarding the absolute draw down and profit values during the test (depending on the currency pair used for deposit and tests) meaning that you lose accuracy simply because something simple was never implemented.

Perhaps what bothers me the most about the MT4/5 strategy testers is the lack of willingness to implement simple features that people really want. How hard is it to implement a spread parameter where you can specify the spread used within the tests ? The truth is that the guys at Metaquotes do not care very much about the end-user of the platform – which is not their client – but they care most about satisfying the needs of those at the other side of the spectrum (their brokers). The fixed spread issue is there because it allows brokers with lower spreads to give “better backtests”, completely neglecting the need for an adjustable spread to be used within the backtests for the end users to actually benefit.

For the above reasons (and certainly more I might have forgot and left out) I have decided that one of next year’s goals in Asirikuy will be the development of an independent testing framework to evaluate trading strategies under our OWN C++ tester. Certainly we will continue to use MT4/5 to run our strategies but we will be able to greatly increase the potential of our testing by using our own independent solution. Certainly this project will not proceed extremely fast – as its speed depends on the availability of coders –  but in the long term we will have a testing solution we KNOW from its heart, where we can change spreads, optimization techniques, and run lighting fast portfolios simulations without the hassle of having to deal with the wishes of the people in Metaquotes and what they wish or do not wish to implement within their platforms.

So certainly I hope that through next year we can start to say “bye bye” to tests being run on the Metatrader platforms and change to a much more robust solution based on what we want to achieve with the accuracy we want to get. Of course, we might continue to use the strategy testers to some extent but our Asirikuy C++ tester will hopefully greatly expand our horizon, allowing us to tests systems way beyond the testing capabilities of the MT4/5 platforms. Of course if you would like to learn more about automated trading system design and evaluation please consider joining, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach to automated trading in general . I hope you enjoyed this article ! :o)

Print Friendly, PDF & Email
You can leave a response, or trackback from your own site.

7 Responses to “Metatrader 4/5 Simulations : Our Intention to Move Beyond”

  1. mcduck says:


    I think Matlab has all the power a scientific/engineering soft can give. Have you considered using it for backtests?. Of course is heavier, not free, but you can implement there any model.

    • admin says:

      Hello McDuck,

      Thank you for your comment :o) I agree without a doubt that matlab is a very powerful software that can be used for backtesting strategies without any restrictions. However the cost (more than 1K USD per license) is prohibitive for many people. One of my most important goals is to make everything in Asirikuy “ours” so that we don’t have to deal with any such license problems. Matlab free alternatives such as Octave and Scilab are also an option but I believe that a C++ solution from scratch (using content of some of the open source indicator and trading libraries available) might be better fit for the job and give us more flexibility in the end. I hope this answers your question :o) Thanks again for the comment,

      Best Regards,


  2. Maurizio says:

    Hello Daniel, thank you for this very important article. The picture seems to be quite worrying and disturbing. We base all our systems and live trading on backtests and on optimisations obtained from MT4, which is in fact a blackbox with a lot of limitations. How can we be sure that the results we have are reliable, if we even don’t know which algorhytms the platform uses and how it elaborates the data? Could you estimate a degree of reliability? Would it be possible that running again the same backtests and optimisations on your new C++ tester will give completely different results on our systems with very bad surprises? We already saw this partially when we had access to real Alpari data: some systems (for ex. GGift usdjpy) and portfolios (ex. Atinalla 1) had different results. Can we run our systems with peace of mind? MT4/5 was clearly from the beginning a platform designed for brokers interest and this is quite worrying. Using a blackbox for our simulations is not the same as using a strategy or a expert advisor without knowing its logic in details, eventually leading to heavy consequences?
    Thank you.
    Kind regards.

    • admin says:

      Hello Maurizio,

      Thank you for your comment :o) I do not think that the simulations we have right now on MT4/5 would have very different results on our independent C++ tester. If you have accessed the Asirikuy forum Andrei has already shown that you can reproduce results in a pretty straightforward manner. I am therefore not talking that much about whether or not current results are wrong (which certainly isn’t the case ) but about how the current MT4/5 framework limits our development of future strategies. Certainly such changes as those experimented when we changed data will not happen as the results of each individual simulation are always going to be the same – or very similar – provided that the data remains the same (something which – as I said – Andrei has already shown is true). Having access to our own tester will however allow us to explore many other options not available within MT4/5 and to get accurate results for simulations on accounts where the deposit and quotes currencies of the pair traded are different. The tester will also most likely work on an independent-platform basis, so people using Linux or Macs will also be able to carry out their own simulations without having to worry about slow-downs or incompatibilities of Metatrader 4/5. I hope this answers your concerns Maurizio :o) Thank you very much again for your comment,

      Best Regards,


  3. mcduck says:

    Out of curiosity, if the C++ code is able to perform tasks that MT4/5 are enable, how would be the interaction with the broker?. At the end of the day MT4/5 is not necessary to submit orders to the broker?.

  4. Maxim says:

    Hi mcduck,

    I’ve once checked the “MT4/5 is not necessary to submit orders to the broker” issue and have found out that Metaquotes have an API to the server at broker’s site. The problem is that that API is unavailable to us as traders or developers.
    I would also recommend to implement the testing framework in C# since it is much more simple than C++. The C# optimizer does a great job thus allowing us to benefit from performance, comparable with that of C# yet having much less headache.


    • admin says:

      Hello Guys,

      Thanks a lot for all the comments :o) Certainly there are ways in which we can trade without MT4/5 but right now this is not an option since we would need to have significantly larger accounts in order to be able to use the brokers which allow us to connect to them directly through a C++ or Java API. This is a possibility when accounts go beyond 10K but for most Asirikuy members and retail traders – who are the main focus of my efforts – MT4/5 are the best choice for execution. Obviously in the future we might move this way but a very important part of Asirikuy for me is to maintain system implementations and support for the MT4/5 programs regarding execution.

      About the programming language for the tester, I have to say that this will depend on the coder(s) who will take care of this project. Right now Andrei is going to start work on this and since he is already implemented a lot in C++ (which he seems to prefer) then we will most likely have a C++ tester. Another thing is that the open source indicator libraries are in C/C++ so potentially a lot of time is saved by programming the tester in this language. Obviously the language choice is most relevant to those working directly in the programming of the project, I for one am comfortable with C++ and C# and I believe that either language is able to fulfill what we want to do. That said if you guys want to discuss this programming and language aspects more in depth I encourage you to post on the Asirikuy forum within the Backtesting section where a thread has been opened for this topic.

      Thanks again guys for all your comments :o)

      Best Regards,


Leave a Reply

WordPress › Error

The site is experiencing technical difficulties.