Please, bear in mind that MT5 is more resource consuming than MT4, so porting EA to MT5 (as others suggested) can make things even worse.
That's not serious to say such things without any explanation or reference.
Without even talking about multi-thread, MT5/mql5 is much faster in general. Of course there are always exception.
Porting an EA to MT5 can improve the speed without any doubt.
This is just a matter of measurements. What reference do you want? There was a long discussion on the forum, where I have already stated the same point of view, according to my experience. Some other people were also noted their pros for MT4 and contra for MT5.
I must say that the measurements may bring significantly different results depending from power of your PC. If it's something brand new with a large reserve of resources, MT5 will be "happy" (though MT4 is also lightning fast, but lacks new features of MT5). While you move along an imaginary axis of PC power to the left, where ordinary PCs reside, you'll notice that MT5 will slow down gradually and at some point MT4 will become faster on the same PC. I suppose your PC is new, but mine is not. This is why we're on opposite sides of the axis and have conflicting evidences.
Forum on trading, automated trading systems and testing trading strategies
Why is it better MT5 than MT4?? Does it have fewer limitations ???
Stanislav Korotky, 2017.01.22 21:24
The last time I checked a single MT5 test was still single-core and single-threaded. So porting to MT5 will not help.
- Stanislav is right. The OO overhead of MT5 slows execution down by a factor of up to 3. Your mile age may vary, depending on the OO you use in your code.
- Cloud will not help. Whoever claims this never tried. Probably he will ask for prove anyway. That's because "he" never tried so "he doesn't know better". Funny days. Just do it!!! Stop asking others to do it for you. Others already did.
What helps: profiling, reduction of duplicate code, nested loops. Bar model "Bar Open". Replacing of iCustom() calls with local code. If nothing helps move excessive code into a DLL. That gives an execution gain factor of up to 10. By the way, doesn't work with the cloud. But wait, you want prove I guess for C being faster.
It's not about me, I understand you, but your previous post could be read as "MT5 is even worse". It lacked nuances. Now it's clearer.
My PC is from 2010, with an i7 860. MT5 is more resources consuming, that's a fact. How it affects a backtest speed depends of the EA I suppose.
Exact. Backtesting is single-threaded, cloud will not help. Optimization is multi-threaded, cloud will help.
You are also right about OOP, if you want maximum speed don't use OOP at all. OOP is not mandatory. That's exactly the same as for MT4, you can use OOP or not.
I did not mean OOP overheads. IMHO they are barely noticable. Overheads come from completely new platform architecture, built in mind with new powerful hardware. This is the same as with Windows versions: every new one is bigger and introduces new hardware requirements.
As for MT, you can compare executable file sizes just for beginning: MT5 terminal is 4 times bigger than MT4 - what this means? a lot of new features which sit somethere in background ready for you, but they work at the expense of additional resources.
OOP is not recommended, in fact the tester is not recommended,
Imagine you can do more, and get more and faster and more accurate results, by running a few simple loops in on init function() when compared to endless testing...
The way it is build it is just inadequate.
It's not capable, by it's architecture to extract the necessary information from your historical data.
If you really want something snappy you can see to use Convolutional layers, with subsampling and rectified linear unit activation function.
At least this will put meaning to the word optimization and the results will becomes much more like a high definition liquid, which has no difficulty in taking on every shape or form it encounters...
This in comparison to an 8-bit super Mario representation sampled over and over, a million times just to discover the borders of it's track. <-- Pre historic modeling.
OOP dont affects to performance ( with optimizers almost all hierarchy layers are removed ). Who affects the perfromance is the low skills of coder. As everything in the life if somebody dont understand how works something its difficult can do it work in optimal way. I'm tired read OOP is the worst thing in the world when its only a good way to sort the code and can to reutilize it
Its not about OOP but about the tester and it's methods.
This topic is about backtesting speed. "OOP doesn't affect performance" is just in your mind. OOP affects performance in mql4/mql5, that's a fact, try it, compare and measure to adjust your mind to reality.
That doesn't mean OOP is bad or anything, but speed is certainly not an argument in favor of OOP with mql4/mql5 . I am tired to read "mind view" with no facts to support it. In any sense. Programming, including OOP, doesn't need "supporters", it needs facts and scientific approach.
Attached, well known MovingAverage EA provided with each platform, and the same EA where I used some classes from Standard Library. Make some backtests and come back to tell us that "OOP dont affects to performance".
2017.08.13 14:12:31.109 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.062. Test passed in 0:02:06.782 (including ticks preprocessing 0:00:11.250).2017.08.13 14:15:50.670 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:55.875.2017.08.13 14:19:13.222 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:58.328.2017.08.13 14:21:32.225 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:01:57.204.
"Normal" version. ^
2017.08.13 14:24:29.951 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.141. Test passed in 0:02:24.906 (including ticks preprocessing 0:00:11.610).2017.08.13 14:27:09.976 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:02:19.984.2017.08.13 14:29:28.202 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Environment synchronized in 0:00:00.031. Test passed in 0:02:13.094.2017.08.13 14:31:59.773 Core 1 EURUSD,M5: 89021070 ticks, 252073 bars generated. Test passed in 0:02:19.703.
"OOP" version. Such very basic OOP usage is already 12.5% slower at minimum. ^