chart "Refresh" causes the plots to be misbehave

 

After I compile the indicator, on the chart, the lines are drawn correctly.

However, if i then right click on chart and click "REFRESH", the lines are messing up and drawing strangely... 

what happens? should I use something code in INIT/DEINIT?


 ChartRedraw() doesnt help. also, I've tested and before/after refreshing, the "rates_total" and "prev_calculated" values are not changed... so what changes there?

 
There are no mind readers here, we can't see your broken code. Most likely, you have some temporaries from the previous iteration, instead of using a buffer.
 
whroeder1:
There are no mind readers here, we can't see your broken code. Most likely, you have some temporaries from the previous iteration, instead of using a buffer.


YES, you are correct! I had temporaries !


BTW, is there any way to keep those temporaries in this situation? any solution? 

 
If they are static or global, fine as long as you don't reprocess bar zero. Otherwise use buffer(s) so you can get the previous values for the current buffer.
 
whroeder1:
If they are static or global, fine as long as you don't reprocess bar zero. Otherwise use buffer(s) so you can get the previous values for the current buffer.


"don't reprocess bar zero"  -

can you tell me two words about this? what does this mean I dont know, or how to do it programatically?

Reason: