Hi,
I noticed that some custom indicators do not redraw themselves automatically to the new bars with every incoming tick or bar. Only when you first open the chart or when you click a different time frame and then chick back their lines get redrawn to the last bar.
So what is making them behave like that?
Going to Charts/Refresh or rightclicking Refresh doesn't help and adding WindowRedraw() to the code doesn't help either.
I've read that the problem may be that such indicator(s) use a limit, i.e. the IndicatorCounted() function severely limits the loop for the indicator in order to not repaint bars.
Here is an example of the limit in such an indicator:
Thanks for providing a solution.
I noticed that some custom indicators do not redraw themselves automatically to the new bars with every incoming tick or bar. Only when you first open the chart or when you click a different time frame and then chick back their lines get redrawn to the last bar.
So what is making them behave like that?
Going to Charts/Refresh or rightclicking Refresh doesn't help and adding WindowRedraw() to the code doesn't help either.
I've read that the problem may be that such indicator(s) use a limit, i.e. the IndicatorCounted() function severely limits the loop for the indicator in order to not repaint bars.
Here is an example of the limit in such an indicator:
PHP Code
int i,limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-Periods-1-counted_bars;
//---- main loop
for(i=limit; i>=0; i--) {
Thanks for providing a solution.
Free Programmer for Profitable Strategies