What happens when scrolling the chart back? - page 2

 
You may have missed the subtlety of what I said but I picked up your sarcasm just fine Raptor. Hahaha :D
 
Trevhib:
You may have missed the subtlety of what I said but I picked up your sarcasm just fine Raptor. Hahaha :D
A bit of sarcasm, more self deprecating . . . to be honest I wasn't 100% sure your post was aimed at me
 
:)
 

Update: Indicator_Counted also returns 0 when internet was disconnected and reconnected long enough that some bars would be missing when it reconnects.

 
SDC:

Update: Indicator_Counted also returns 0 when internet was disconnected and reconnected long enough that some bars would be missing when it reconnects.

Additionally it returns 0 every time a chart gets refreshed (by sending a system message). Unluckily, indicators which rely on IndicatorCounted recalculate all its values every single tick on offline charts.
 

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.

 
SDC: why this corrupted indicator problem happens 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.