Errors, bugs, questions - page 2491

 
Alexey Navoykov:
I have noticed for a long time that highlighting 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 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. Does anyone else see this in their own file?
Yes
 
Alexey Navoykov:
I have noticed for a long time that highlighting custom macro names in a large project does not always work. Many macros defined in other files are not highlighted for some reason. I cannot figure out the 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 have noticed something similar. I can't vouch for the accuracy of the situation.

 
Alexey Navoykov:
For a long time I've noticed that custom macro names in a large project are not always highlighted. Many macros defined in other files are not highlighted for some reason. I can't figure out the reasoning yet, but I see that all macros defined in a certain file stop highlighting in other files after a certain line. Anyone else seeing this in their environment?

Yes, and sometimes autofixing does not work for new variables or class fields, usually it can be fixed by recompiling the project

As far as I understand, in ME in the background runs a process that deals with highlighting and autofixing, at some point, it does not have time (or does not want) to update all the information

 
Now that we are talking about rates_total, let me ask the community what construction in OnCalculate is smarter and more optimal?
I used to use a construction like this in OnCalculate:
if (rates_total==prev_calculated) {}        // новый тик, перерисовываем последний бар, все бары на своих местах
else if (rates_total-prev_calculated==1) {} // момент формирования нового бара 
else {}                                     // пересчитываем последние(rates_total-prev_calculated) бар


But after I realised that there may be situations when prev_calculated>rates_total, I realised that I don't understand anything, I gave up and, if recalculation of all bars takes no more than a couple of seconds, I started using such a construction:

if (rates_total==prev_calculated) {}        // новый тик, перерисовываем последний бар, все бары на своих местах
else if (rates_total-prev_calculated==1) {} // момент формирования нового бара 
else {}                                     // пересчитываем все бары

How do I do it and how do I do it properly?

 
Nikolai Semko:
Since we are speaking about rates_total, let me ask the community what construction in OnCalculate is more elegant and optimal?
I used to use a construction like this in OnCalculate:


But after I realised that there may be situations when prev_calculated>rates_total, I realised that I don't understand anything, I gave up and, if recalculation of all bars takes no more than a couple of seconds, I started using such a construction:

how does anyone do it and how, in general, is it competent?

It's literate because you understand what's going on. Note about your construction: Instead of ==1 I'd write >=1 or just if(rates_total > prev_calculated) so that if missed bars are pumped up they are recalculated.

Plus, in mql5 and with strict directive in mql4, in order not to overshoot the array, we should consider how many bars may be involved in the calculation from the leftmost bar. So it turns out that I personally don't have a template for all occasions.

 
Nikolai Semko:
Now that we are talking about rates_total, I want to ask the community what construction in OnCalculate is more elegant and optimal?
I used to use a construction like this in OnCalculate:


But when I understood that there may be situations when prev_calculated>rates_total, I realized that I don't understand anything and shook my head and, if recalculation of all the bars takes no more than a couple of seconds, I decided to use this construction:

how does anyone do it and how is it done correctly in general?

I calculate limit = rates_total - prev_calculated.
Then, if limit > 1, then limit = rates_total - 1 (or the required number of bars-1 for the first calculation) and initialisation.
And then a loop from limit to >=0.
I can't do the code from my mobile ...
 
Nikolai Semko:
Since we are speaking about rates_total, let me ask the community what construction in OnCalculate is more elegant and optimal?
I used to use a construction like this in OnCalculate:


When I understood that there may be situations when prev_calculated>rates_total, I realized I do not understand anything, so I gave up and used this construction, if recalculation of all bars takes no more than a couple of seconds:

how does anyone do it and how, in general, competently?

In principle, the question is relevant, in the examples from the developers (delivery of MT) different ways of calculation, even BarsCalculated() is used in Bears.mql5

i recently discussed under MT4, so far i've settled on the following pattern:https://www.mql5.com/ru/forum/314931/page2#comment_11946579

i still have to check it on MT5, but charts behave differently (MT4 / MT5), in MT5 if you scroll with the mouse wheel to the beginning of the history, it seems prev_calculated will be reset to zero - last year i wrote an indicator on MT5 and was surprised to see such behaviour

ZZY: make custom chart and by timer scroll through the history - a so-called test bed is needed to trace the rates_total and prev_calculated behavior - I wrote here a couple of pages ago about rates_total and iBars() mismatch - it should also be taken into account

I liked his way of writing indicators - everything is carefully done. The only problem with his codes is a very peculiar style of source code formatting.

 
Igor Makanu:

...........................

a very peculiar style of formatting of the source


 
Сергей Таболин:


I know how to use the styler, but the styler doesn't work if you put several operators in one line

;)

examplehttps://www.mql5.com/ru/code/22766
 

Just a question.

ulong has a maximum value of 18.........

I got a value of 61........

AndIntegerToString() of this value gives out 90............. at all

Took me a while to find the problem.

Is there any way to localise it?

Reason: