Vladimir, why are you doing this inside OnCalculate()? I mean the last two lines - reinitialization of arrays. You have both buffers calculated on each bar, it's an unnecessary action.
Why have you decided that initialization will be performed on each tick? The condition prev_calculated==0 is executed once or twice at indicator start. During the operation prev_calculated==0 may become so if the history is changed - but it rarely or never and the change of history requires recalculation of the indicator.
Karputov Vladimir: Why have you decided that initialisation will take place on every tick? The condition prev_calculated==0 is executed once or twice at indicator start. During the operation prev_calculated==0 may become if the history is changed - but it rarely or even never and the change of history requires recalculation of the indicator.
Can you do without zeroing of buffers during history loading?
Sergei Vladimirov: Where did I write that? I was asking why you re-initialise the buffers in OnCalculate() if you then have both buffers calculated on all bars.
Incorrect statement. When prev_calculated==0 I subsequently bypass all bars, but it does not guarantee replacement of all values in indicator buffers. Therefore, when prev_calculated==0 you need to clear the indicator buffers.
Karputov Vladimir: Incorrect statement. When prev_calculated==0, I subsequentlybypass all bars, butit does not guarantee replacement of all values inindicator buffers. Therefore, at prev_calculated==0 I need to clear indicator buffers.
Yes? Can you give me an example of when in your code some value of some buffer will not be filled? Except maybe the very first bar in the story.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
That's it? It's not going to glitch?
Vladimir, why are you doing this inside OnCalculate()? I mean the last two lines - reinitialization of arrays. You have both buffers calculated on each bar, it's an unnecessary action.
It's not the code that's glitchy. :) Take it and use it.
Thank you:))))))))))))))))))))))))))))))))))))))))))))))))))
Who's next?
Why have you decided that initialisation will take place on every tick? The condition prev_calculated==0 is executed once or twice at indicator start. During the operation prev_calculated==0 may become if the history is changed - but it rarely or even never and the change of history requires recalculation of the indicator.
What makes you think that initialisation will take place on every tick?
Where did I write that? I was asking why you re-initialise the buffers in OnCalculate() if you then have both buffers calculated on all bars.
Thank you:))))))))))))))))))))))))))))))))))))))))))))))))))
Who's next?
Why lie?
Incorrect statement. When prev_calculated==0, I subsequentlybypass all bars, butit does not guarantee replacement of all values inindicator buffers. Therefore, at prev_calculated==0 I need to clear indicator buffers.
Yes? Can you give me an example of when in your code some value of some buffer will not be filled? Except maybe the very first bar in the story.
Why lie?
Genius.
Have you tried switching to a pair with no history and then switching to another TF?
It wasn't a statement, it was a question.
Yes? Maybe you can give us an example, when in your code some value of some buffer will not be filled?
You know, let's do this: take code 1.43 from this post and comment out the lines:
and look at the result when scrolling the graph to the back of the history and have the history loaded.