I’ve been wondering how fast the MQL5 programming language actually is so I made a tiny script using fxDreema to test it.
MQL5 is based on C++ and it is known to be pretty quick.
The script is very simple, it will run a specified amount of iterations of a “while loop” and on completion print results to the experts tab.
Here it is:
https://fxdreema.com/shared/tgzUPoVUb
In the Custom MQL Code block a counter will continue to add 1 to itself until it reaches the setpoint.
The while loop will then complete and the result will be printed to the experts tab.
If you want to try it you can either save it as an .mq5 file and compile it or compile it directly as an .ex5 file and put it in your MT5 scripts folder.
From there just pull it onto any chart and specify how many billions of loops you want it to run.
If I run 100 billion loops on my PC it takes about 87 seconds to complete or in other words about 1.15 billion loops per second; that’s quite impressive!!
I have an Intel i9 10900k.
I ran the same test in Python and it was about 75 times slower.
But, note that a trading EA has many blocks with a huge amount of fxDreema underlying code so any EA will obviously be many thousands of times slower than this test script.
Always try to keep your code efficient.
Have fun!!