Comparing MQL5 back test speed to MQL4

 

Since MQL5 is now live with my broker I tried a speed test. Since I am a n00b at MQL5 I posted my code on the MQL5 forum to make sure I didn't mess up the test.

https://www.mql5.com/en/forum/6475

On my test, the back test was 4x slower with MQL5. The Admin who tweaked my code has an awesome machine and on his test the MQL5 code was 2.6x slower than MQL4.

I'm feeling disappointed with the whole speed of MQL5 thing.

 
Well thats not-encouraging given all the multi-core improvements.
 

Should I reply here, or should I reply there :)

So you wanna speed or correctness ?.

 
onewithzachy:

Should I reply here, or should I reply there :)

So you wanna speed or correctness ?.

I don't know if anyone is claiming that MQL5 is more accurate. I thought I had heard that it was more efficient, faster, and multi-threaded, so to be slower in practice is not what I was expecting.
 

Most likely the claimed speedboost is refered to the optimizer. I do not think that a single simulation run can be parallelized. If you run an optimization MT5 can run as many 'passes' simultaneously as many cores you have.

Depending if the use new execution commands (SSE4 and so on) a single pass might be faster on top-modern cpus.

But expecting a big improvement is unrealistic. An EA has still to process nearly the same data and dooing still nearly the same things (even more on MT5) while the underlying programm is still based on the same windows api. There is not much room for big gains in speed.

 
zzuegg:

Most likely the claimed speedboost is refered to the optimizer. I do not think that a single simulation run can be parallelized. If you run an optimization MT5 can run as many 'passes' simultaneously as many cores you have.

Depending if the use new execution commands (SSE4 and so on) a single pass might be faster on top-modern cpus.

But expecting a big improvement is unrealistic. An EA has still to process nearly the same data and dooing still nearly the same things (even more on MT5) while the underlying programm is still based on the same windows api. There is not much room for big gains in speed.


Yes, agreed.

I must say I love the modern meta-editor in MQL5 with all the auto-bracket sensing etc. I wonder if they will make it work for MQL4 as well -- pretty please :-)

 
dabbler:
I don't know if anyone is claiming that MQL5 is more accurate.

I never said anything about more accurate, as long as it's correct, i'm okay with it.

I thought I had heard that it was more efficient, faster, and multi-threaded, so to be slower in practice is not what I was expecting.

So I heard that too, although compare to what ?. Your back testing here - a good one - make me concern about forward testing. If demo/forward testing or even live running is much slower than MT4, then MetaQuotes better have good explanation for it. As I can remember, there used to be this chart on MetaQuotes site boasting that MQL4 much faster than Ninja Trader, Trading Station, and even C++ if I'm not mistaken (or is it C# ?) , but it's not there anymore and no one from MetaQuotes ever talk about speed execution of MQL5 compared with other trading platform, other than what Renat did.

 

I wonder about changes with slowing if this happened, because I noticed slower performances too with mt5:

In mt4 : sleep(0) with int's in code used is faster from double's used, near~ from x3 up to x10, with sleep(>0) it's kind of small difference, ie. with continuous script work 60 sec it is ~300ms difference. So probably, it is my guessing, (because strings can not be changed for speed up) tasks in mt5 are more based on doubles.


 

I tested a medium complex EA in MQL4 and MQL5....

maybe I still made some mistakes but basically I think I got it right in MQL5. The testing without opitmizer is FAR slower than in MQL4,

I'd say in MQL5 it feels closer to "Visualization" than in really full speed testing (I tested of course without Visualization turned on).

In MQL4 a test for 6 weeks data (M1 every tick) took about 2 minutes, in MQL5 it is taking HOURS.

In fairness I have to admit that I changed the broker (from XTB to ActivTrades), so maybe my old broker didn't provide really tick data...

 
claudio_arrau2:

I tested a medium complex EA in MQL4 and MQL5....

maybe I still made some mistakes but basically I think I got it right in MQL5. The testing without opitmizer is FAR slower than in MQL4,

I'd say in MQL5 it feels closer to "Visualization" than in really full speed testing (I tested of course without Visualization turned on).

In MQL4 a test for 6 weeks data (M1 every tick) took about 2 minutes, in MQL5 it is taking HOURS.

In fairness I have to admit that I changed the broker (from XTB to ActivTrades), so maybe my old broker didn't provide really tick data...

No Brokers provide tick data, MT4 and MT5 use M1 data and synthesise the ticks, you should export the data from MT5 and use that in MT4 so the base M1 data has the same number of ticks.
 
claudio_arrau2:

I tested a medium complex EA in MQL4 and MQL5....

maybe I still made some mistakes but basically I think I got it right in MQL5. The testing without opitmizer is FAR slower than in MQL4,

I'd say in MQL5 it feels closer to "Visualization" than in really full speed testing (I tested of course without Visualization turned on).

In MQL4 a test for 6 weeks data (M1 every tick) took about 2 minutes, in MQL5 it is taking HOURS.

In fairness I have to admit that I changed the broker (from XTB to ActivTrades), so maybe my old broker didn't provide really tick data...

Your mql5 EA is probably not efficient. There is no other reason the same algorithm will take minutes to be backtested with MT4 and hours with MT5.