You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The reason for the main retardation of MT5 is the imitation of the full trading environment. In the vast majority of Expert Advisors, such an accurate simulation is not necessary. An excellent solution for such Expert Advisors would be to switch to a simplified testing mode, with simple modelling of the trading environment. However, there is no such possibility. But if you write your own, simplified strategy tester and run it in the mode of mathematical calculations, the speed of optimisation will be fire! This is what I suggest that everyone who wants to dramatically increase the speed of EA optimisation should think about.
In CStrategy, trading operations are performed through CTrade directly. I.e. CStrategy has no trading logic of its own at all. In the test Expert Advisor I did not see any other trading logic than opening/closing a position after N seconds. CStrategy also does not store historical positions, so this example is unfortunately not realisable in CStrategy.
CTrade doesn't store history either, but that didn't prevent us from implementing the variant through it.
The fact that OOP code is slower than procedural code does not tell me anything. Let's get to the point: which CTrade methods are a bottle neck? Why? What does the profiling of these methods tell you? How do you identify slow code sections in the tester?
I haven't analysed the reasons of SB brakes, but I don't think it's OOP, because MT4Orders is also written through OOP, even if it's minimal. After a request to the BOD, the developers accelerated the SB. I don't know whether they have tweaked the SB itself or the compiler.
I myself analyse absolute brakes first, and then - relative ones
MetaTrader 5 has an excellent function of profiling an Expert Advisor on historical data. But, besides the fact that it works slowly (in visual mode), the final result is provided in relative units, i.e. it is impossible to compare performance in absolute terms.
The reason for the main slowdown of MT5 is the imitation of the full trading environment. In the vast majority of Expert Advisors, such an accurate simulation is not necessary. An excellent solution for such Expert Advisors would be to switch to a simplified testing mode, with simple modelling of the trading environment. However, there is no such possibility. But if you write your own, simplified strategy tester and run it in the mode of mathematical calculations, the speed of optimisation will be fire! This is what I suggest you to think about for all those who want to dramatically increase the speed of EA optimisation.
Through custom symbols you can achieve orders of magnitude speedup with full simulation. Actually, even now in the beta mode of custom symbols it is possible to achieve this. I will do it later.
MT4Orders:
MQL5 turned out to be slower than the library written in the same MQL5! I started to investigate and found the reason by making this substitution
MQL5 variant of the Expert Advisor started to show such performance.
Stupid replacement of PositionSelect with PositionGetTicket raises the backtest speed by 7%!
MT4Orders lags behind the maximally optimised pure MQL5 by less than a percent.
The places were distributed as follows
I tweaked the SB itself a little bit (pieces of SB used by the Expert Advisor), without changing the functionality and versatility. It became not 84%, but 97%.
Those who use SB, take note of the potential possibility of acceleration.
It became interesting to compare the performance of the same MT4 multicurrency Expert Advisor converted in different ways.
Full conversion
and artisanal (fast) conversion
Forum on trading, automated trading systems and testing trading strategies.
Expert Advisors: Spreader
fxsaber, 2016.09.03 11:18 AM.
Results of performance measurement.
Full-fledged version
Artisanal
The artisanal one loses significantly. The reason is simple - if you want fast timeseries, you can't convert MT4 timeseries head-on
Forum on trading, automated trading systems and testing trading strategies.
Libraries: CPrice
fxsaber, 2016.08.28 10:36 AM
Look at such an option
You can, as in MT4, call Open[bar], High[bar], Time[bar], Volume[bar], etc. And also iHigh(...), iClose(...) and others.
You need to use (not only for bush, but also for full-fledged variants) solutions like this.
The artisanal one loses significantly. The reason is simple - if you want fast timeseries, you can't convert MT4 timeseries head-on.
Wrong conclusion. The reason for the brakes is quite different. Let's insert only one line into each of MT5 variants
And measure again
The full-fledged one is 67% faster, the artisanal one is 108% faster! In summary, the gap is now small - full-featured is ~11% faster than artisanal. There, it seems, the reason is in the OOP overhead.
But that's not the main thing. With one line we managed to speed up EAs! And this is in the Optimiser, where Comment doesn't play any role.
Forum on trading, automated trading systems and testing trading strategies
Libraries: TesterBenchmark
fxsaber, 2017.07.24 14:13
trading SB is 1.5 times slower than pure MQL5!
This was written in the summer along with the SD application. I'm surprised that everything is even! Or is it logical? How can one talk about super-speed of the tester when almost all EAs (using SB) fail in speed, eat money in the Cloud, etc.! Apparently this is normal.
I simplified the source code by throwing out the work with History and MT4Orders. I left only pure MQL5 and SB
SB result
Result of pure MQL5
All the same 1.5 times! But the suckers don't care, let's continue to use super-SB.
Same 1.5 times! But the suckers don't care, let's keep using the super-SB.
This is the kind of SB tweaks
miraculously speeds up the SB advisors. Is it complicated?
Frankly speaking, the trading SB, without changing the API logic, should be rewritten almost completely. Any piece of it is bad.