Errors, bugs, questions - page 2490

 
Slava:

Have you carefully read my quote in the post below?

This behaviour has always been there since the introduction of the "maximum number of bars per chart" setting , i.e. since the beginning of MT4. And we have explained many times over those 15 years why we do not cut back the number of bars according to that setting every time. And now we don't cut back every time.

Nobody reads the documentation. But it's a paradox. They still ask us to write something else in documentation that they don't read.

Slava, I have no complaints. I read carefully and not only your quote and this one

Forum on trading, automated trading systems and trading strategies testing

Bugs, bugs, questions

Slava, 2019.06.29 18:25

rates_total always shows the number of bars available on the current chart.

I do not understand the meaning of your statement

and this

Forum on trading, automated trading systems & strategy testing

Bugs, bugs, questions

Slava, 2019.06.29 18:42

I don't have the client terminal at hand right now to quote the help. From mobile device in two clickshttps://www.metatrader5.com/ru/terminal/help/startworking/settings#max_bars

Specially highlighted paragraph.

For a more economical calculation, indicators may have more bars available than specified in "Max bars in window" parameter. As new bars arrive, older bars are not immediately removed from the data cache. This allows the indicator not to be recalculated completely at each new bar, but only to additionally calculate its values for new bars.

I have read the documentation more than once. But I have made pictures on the recently started terminal. There were only 5000 bars in the window, new ones have not had time to be loaded yet.

Of course, I do not understand something, that is why I ask again and try to understand. I guess there will not be any changes. Please do not take my statements as a complaint.

 
Igor Makanu:

The reference is not correct, it is misleading, I wrotehttps://www.mql5.com/ru/forum/304239/page57#comment_11519307

In MQL5 the buffers in general work as usual arrays, in MT4 the terminal dealt with buffers - it reset them to EMPTY_VALUE, then ... I don't remember where I wrote about the difference between MT5 and MT4 indicators

You need to clear the buffers - you clear them as a usual array, the terminal only sets the size of the array-buffer itself.

Igor, can you explain in plain Russian: if each hole of the indicator buffer will be filled with some values, which will replace the rubbish contained there, what is the purpose of forcing these holes before filling them with the right values? For loss of execution speed?

 
Alexey Viktorov:

Igor, can you explain in plain Russian: if each hole of the indicator buffer will be filled with some values that will replace the trash contained there, what's the purpose of forcefully clearing these holes before filling them with the needed values? For loss of execution speed?

filling of "holes" is critical only in an indicator with "arrows", in MT4 during the initialization of the indicator these "holes" will be filled automatically by the value EMPTY_VALUE

in MT5 it must be done by the programmer

or in MT5 the programmer should fill the indicator buffers via the if() else construct

i.e. this will work in MT4:

if(...) Buf[i] = high[i];

in MT5 you have to write:

if(...) Buf[i] = high[i]; else Buf[i] = EMPTY_VALUE;

or in MT5 you need to clear the indicator buffers, otherwise the indicator will draw "rubbish" from the array, which is bound by the indicator buffer ...., when you switch the TF. it is a matter of taste how to write and what to take into account


SZY: speed? Well, measure the speed, in 99% of cases the built-in functions are faster, but there is no difference in performance between filling every bar in the loop EMPTY_VALUE and one initialization with ArrayInitialize(Buf,EMPTY_VALUE)

 
Igor Makanu:

filling of "holes" is critical only in an indicator with "arrows", in MT4 during the initialization of the indicator these "holes" will be filled automatically by the value EMPTY_VALUE

in MT5 it must be done by the programmer

or in MT5 the programmer should fill the indicator buffers via the if() else construct

i.e. this will work in MT4:

in MT5 you must necessarily write:

or in MT5 you need to clear the indicator buffers, otherwise the indicator will draw "rubbish" from the array, which is bound by the indicator buffer ...., when you switch the TF. it is a matter of taste how to write and what to take into account


Well, measure the speed, in 99% of cases the built-in functions run faster, but there is no difference in performance between filling each bar in the EMPTY_VALUE loop and initializing it once with ArrayInitialize(Buf,EMPTY_VALUE).

All this is just a nag. That's how it was, that's how I want it, it's hard to change my habits and other reasons.

The if else construct can easily be replaced with

Buf[i] = условие ? high[i] : EMPTY_VALUE;
 
Alexey Viktorov:

It's all just nagging. That's the way it was, that's the way I want it to be, changing my habits is difficult, and other reasons.

The if else construct is easily replaced with

If you're being picky, tips on increasing performance in C++ or C# just recommend not to use "conditional operator ? : " I think I read an article on Habra once (I haven't tested it, I write as convenient as possible)

;)

 
Igor Makanu:

If I'm being picky, the advice on how to improve performance in C++ or C# is to not use "conditional operator ? : " I think I read an article on Habra once (I haven't tested it, I write as conveniently as possible myself)

;)

The compiler is not an idiot and optimizes better than a guru on Habra
 
Artyom Trishkin:
Well the compiler here is not an idiot, and optimises better than the "gurus" on the hubr

On such occasions I always repeat: "The sun rises in the morning and sets in the evening..." - Do you see any logic here? - Yes, it's logical, but is there information in my sentence? - It's not there.

i won't test it ? : , compiler machine.... Hubr, good...

 
Igor Makanu:

i won't be testing ? :

Tested MT5:

2019.06.30 13:37:04.230 tst (EURUSD,H1) Testing if() cycles=99999999999999 time=10859 ms

2019.06.30 13:37:15.116 tst (EURUSD,H1) Testing ? : cycles=999999999999 time=10891 ms

2019.06.30 13:38:05.348 tst (EURUSD,H1) Testing if() cycles=99999999999999 time=10843 ms

2019.06.30 13:38:16.190 tst (EURUSD,H1) Testing ? : cycles=999999999999 time=10844 ms

2019.06.30 13:38:32.111 tst (EURUSD,H1) Testing if() cycles=99999999999999 time=10860 ms

2019.06.30 13:38:42.955 tst (EURUSD,H1) Testing ? : cycles=999999999999 time=10843 ms

Tested the MT4:

2019.06.30 13:46:09.087 tst EURUSD,H1: Testing ? : cycles=999999999999 time=33234 ms

2019.06.30 13:45:35.854 tst EURUSD,H1: Testing if() cycles=99999999999999 time=32953 ms

2019.06.30 13:44:43.421 tst EURUSD,H1: Testing ? : cycles=999999999999 time=333298 ms

2019.06.30 13:44:10.094 tst EURUSD,H1: Testing if() cycles=99999999999999 time=33016 ms

2019.06.30 13:42:56.925 tst EURUSD,H1: Testing ? : cycles=999999999999 time=33344 ms

2019.06.30 13:42:23.584 tst EURUSD,H1: Testing if() cycles=99999999999999 time=32953 ms

MT developers, as always on top of the game!
 
I've noticed for a long time that highlighting custom macro names in a large project doesn't always work. Many macros defined in other files are not highlighted for some reason. I can't figure out the pattern yet. All I see is that all macros defined in a certain file after a certain line stop highlighting in other files. Anyone else see this in themselves?
 
Alexey Navoykov:
I have noticed for a long time that the highlighting of user-defined macro names in a large project does not always work. Many macros defined in other files are not highlighted for some reason. I can't find a pattern yet. All I see is that all macros defined in a certain file stop highlighting in other files after a certain line. Anyone else see this happening to themselves?

I've noticed that if you write as a parameter of any function, it doesn't light up. I think it's not a complete match type. Or how to call it more precisely do not know.

Reason: