Discussion of article "LifeHack for traders: Fast food made of indicators" - page 13

 
Vladimir Karputov:

- you had a nice code and a description of the measurement results.

I didn't get a chance to look at the code

 

calling indicators in MQL4 mode, the speed is lower by 40%.

MQL5-style

i = 0 Pass = 0 OnTester = 7.679 s.: Count = 9986677, 1300517.9 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755
i = 1 Pass = 1 OnTester = 7.645 s.: Count = 9986677, 1306301.8 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755


MQL4-style (without cache)

i = 0 Pass = 0 OnTester = 14.117 s.: Count = 9986677, 707422.0 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755
i = 1 Pass = 1 OnTester = 14.067 s.: Count = 9986677, 709936.5 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755


MQL4-style(with cache)

i = 0 Pass = 0 OnTester = 10.077 s.: Count = 9986677, 991036.7 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755
i = 1 Pass = 1 OnTester = 10.104 s.: Count = 9986677, 988388.5 unit/sec, Agent = C:\Program Files\Alpari Limited MT5\Tester\Agent-127.0.0.1-3000 build = 1755

The cache variant is 32% slower than the MQL5-style variant. As for the cacheless variant, the mentioned 40% could not be obtained. As before, it is twice as slow. But the coincidence in terms of profit is certainly present.

 

Sorry but I don't even understand why this article was allowed to be published by Metaquotes.

The main advantages of indicator handle in mql5 is the ability to get several values from a buffer, you completely discard it. And that to provide a code which will be largely less efficient most of the time ! I am not even about bad coding practice consisting to not check returned value of a function.

This article is useless or even worst. Don't be surprised people want to keep using mql4.

 
Alain Verleyen:

Sorry but I don't even understand why this article was allowed to be published by Metaquotes.

The main advantages of indicator handle in mql5 is the ability to get several values from a buffer, you completely discard it. And that to provide a code which will be largely less efficient most of the time ! I am not even about bad coding practice consisting to not check returned value of a function.

This article is useless or even worst. Don't be surprised people want to keep using mql4.

I don't think you are right. This article firstly helps not so educated and flexible hobby programmers to understand the handling of the indicators in mql5 compared to mql4 and shows them secondly a way how they can use indicators the same way they are used to in MQL4.
 

If i run a simple iVolume in a loop, over all available instruments, in MQL5, then the platform just freezes up, the massive copybuffer calls act like a ddos attack on the operating system, it just trips, where if i do this same process in MQL4, it runs smooth like a pack of hot molten butter.

On the same machine, and that tells me more then i need to know.

Combine that with all the signals and noise coming from the community which tells me that my conclusions were right all along.

 
Mark only
 

The problem is: why do I have to copy the buffer every time I have to read the indicator value? The buffer is there, already computed, why can't I access it's value directly?

This is a non-sense!

I should only have direct access to the indicator buffer, copying it over and over will only degrade the performance.

I really don't understand why Metaquotes has followed this way of work.

CopyBuffer(...) vs   buffer[i] ?

 
ludoz:

The problem is: why do I have to copy the buffer every time I have to read the indicator value? The buffer is there, already computed, why can't I access it's value directly?

This is a non-sense!

I should only have direct access to the indicator buffer, copying it over and over will only degrade the performance.

I really don't understand why Metaquotes has followed this way of work.

CopyBuffer(...) vs   buffer[i] ?

Because that's not so simple. The indicator run on one thread and an EA on an other thread (and you can have several indicators/several EAs). If you are complaining about such a simple procedure as handle/CopyBuffer, you don't want to proceed with multi-threaded application, believe me.

mql5 provides generic solutions, able to manage most of the "normal" situation. If you have specific issue on your project, there are always solution.

 
It's MQL5 now, but most people still use mt4.