![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
You may have missed the subtlety of what I said but I picked up your sarcasm just fine Raptor. Hahaha :D
Update: Indicator_Counted also returns 0 when internet was disconnected and reconnected long enough that some bars would be missing when it reconnects.
Update: Indicator_Counted also returns 0 when internet was disconnected and reconnected long enough that some bars would be missing when it reconnects.
Did anyone ever figure out why this corrupted indicator problem happens when chart history is added ? Reinitializing the buffers is a workaround but there must be some other factor because for example a regular moving average indicator doesnt mess up when chart history is added.
What "corrupted indicator?" IndictorCounted() returns zero and the indicator should recalculates all bars just like it does on initial add.
If resetting all buffers "fixes" the problem, then your code is broken, it's not recalculating all buffers correctly (skipping buffers or reading uninitialized elements)
Well yes I know it should do that but sometimes it redraws the indicator while leaving the old line behind on the screen like this:
Begining of indicator when first loaded, it loads properly and calculates all the bars correctly and it works correctly on bar zero
but if I scroll the chart back so history is added ... it redraws the indicator correctly with new lines but it leaves the old red and blue lines behind ...
If i then bring up the properties box and click ok on it .... The old lines are removed leaving the new lines as they should be.
I would like to know why that happens so i can fix it ... that indicator uses 3 loops ...
1 to fill two arrays
2 to do ImaOnArray() on those arrays and draw the green bands
3 to draw red and blue lines. (the problem only seems to affect these two lines)
Well I have changed my code around a few different ways it must be what you said WHR, it doesnt like the skipped buffers. I wrote it to be that way so I guess all I can do is reinitialize the buffers when IndicatorCounted() returns zero ...
Update: Fixed the problem. Filled all the unused buffer indexes with EMPTY_VALUE ... it works properly now. Thanks to WHR for pointing out the skipped buffers. The new values did not need all the buffer indexes because of the intentional gaps in the lines, so any not overwritten when the chart history was extended were left behind.