Topic: MT4 Charts Do Not Trade Equally
I've been testing FSB-generated portfolio EAs (created by Portfolio Maker) on MT4 and comparing their trading behavior compared to the same strategies attached to their own charts (more on that in a different post). One of the tests I ran was to clone a very simple strategy (actually, one created by EA Studio) and attach 20 copies of identical strategies to 20 EURUSD/M5 charts and let those run for a few hours. The expectation was all 20 strategies would trade either identically or nearly identically. However, that does not appear to be the case.
The image above was taken from MT4 Tracker. You can see the 20 strategies with magic numbers ranging from 2001 through 2020. Though their stats may be similar, the number of trades varies from a low of 69 to high of 153. I've attached a *.zip file in case anyone else is interested in trying this same test. Again -- these 20 strategies are identical and only differ in their magic number.
I do not have an explanation -- but I do have a theory. Keep in mind that MT4 is a "black-box". It is proprietary software and only MetaQuotes knows its performance limitations -- and they would never make that information public. So, my theory is strictly a guess. I do NOT think there is anything devious going on. MT4 is a fairly complex, multi-threaded, near real-time application that performs both data acquisition (over the Internet) and graphical charting. We all know it is very CPU-intensive. In fact, each chart you open increases the memory foot-print of MT4 by something like 20-30 MB.
MT4 is a multi-threaded application. Each chart runs in its own thread. There are also other threads -- e.g. retrieving broker data, sending / receiving order information, handling UI requests, redrawing charts -- and more. Furthermore, there is limited CPU available. The CPU's availability is divided into time-slices. Each thread gets one or more time slice, and then it gets put to sleep and the next thread is allowed to run. In most cases this is transparent to the user. A real-time application like MT4 likely prioritizes its threads -- i.e. some are more important than others. For example, the thread that retrieves broker data is more important than the thread that updates chart #7. So, let's say MT4 has 30 time-slices to work with each time Windows gives it the CPU. The first thing MT4 does is use 15 of those to download the broker's most recent tick data -- leaving 15 time-slices. Next, it calls the OnTick() code for chart #1 -- and let's say those calculations take up another 2 time-slices, leaving 13. Next, it calls the OnTick() code for chart #2, again taking up another 2 time-slices, leaving 11. And so on. By the time it gets to chart #8 then Windows tells MT4 its time is up and the CPU is given to another app or service running on your machine.
Sometimes all the OnTicks get processed, sometimes only a subset get processed. I think this may be why not all charts trade equally. There is limited CPU plus MT4 probably sets the priority of different threads (which is very common in multi-threaded apps).
So what does this mean? I'm not sure. However, I believe this is related to an observation that alamehmazen123 and I made about the portfolio EAs created by Portfolio Maker. The strategies bundled in the portfolio EA trade less frequently than the corresponding strategies attached to their own chart. I've posted about this before and also added an FAQ to the mt4tracker.com website.