Indicator not refreshing - page 2

 
billworld: Is that the best way to handle new bar checks within an indicator?
There is no need to check for new bars in indicators. It is handled by the indicatorCounted and the for loop.
billworld: I don't want or need for bar 0 to update every tick, that's why I insert NewBar().
Then don't count down to zero (count down to one)
 
billworld:

I don't want or need for bar 0 to update every tick, that's why I insert NewBar().

Well ok but now you are recalculating the entire indicator history on every new bar too is that what you wanted ?

 
SDC: Well ok but now you are recalculating the entire indicator history on every new bar too is that what you wanted ?
No you are not. Bars -1 -counted will be 1 ONLY on a new bar Bars -1 -counted will normally be zero. Only initially or new history will Bars -1 -Counted be Bars-1
 
WHRoeder:
There is no need to check for new bars in indicators. It is handled by the indicatorCounted and the for loop. Then don't count down to zero (count down to one)


Thanks. I wasn't sure if there is much of an unnecessary hit on performance to constantly update bar 0 with each tick when the indy is used just for end of bar signals. Counting just to 1 makes perfect sense and is of course more elegant than my NewBar() idea.

This is how the count is now coded.

int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   double Value;

   for(int i=1; i<limit; i++)
      PowerBuffer[i] = Value(i);
   
   return(0);
  }
 
WHRoeder:
No you are not. Bars -1 -counted will be 1 ONLY on a new bar Bars -1 -counted will normally be zero. Only initially or new history will Bars -1 -Counted be Bars-1

Yes, you are right, I misread the OP's code