Change code to make it no repaint

 

int start() {
   int limit, i, counter;
   double RSI, RSIp, CCI;
   double Range, AvgRange;
   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-counted_bars;
   
   for(i = 0; i <= limit; i++) {

      counter=i;
      Range=0;
      AvgRange=0;
   
      for (counter=i ;counter<=i+9;counter++)
{
      AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }


To make the indicator attached no repaint, I know that these highlighted parts must be changed in order to make the loop go from the limit down to 0, with i--

But I just want to have an opinion of an expert coder about how to change it, to avoid errors...

Attached is the indicator.

Thank you.

Files:
 

That indicator is not having only that problem. It is, among other things, explicitly using future values for crosses.

In any case use sidus 3 indicator 0 that is the non-repainting version of that indicator

 
Mladen Rakic:

That indicator is not having only that problem. It is, among other things, explicitly using future values for crosses.

In any case use sidus 3 indicator 0 that is the non-repainting version of that indicator

It's not how you think.
 
Jox90:
I tried that version but parameters are totally different. I know that crosses use future values, and I have already changed them to use i instead of i-1 (in a test version), but I need to change also the parts highlighted above to make it fully no repaint...can you tell me how should I change that?

Yep

Somebody patched cci and some other stuff to it (my guess : to mask that it is actually the sidus indicator). Quite frankly I suggest that you forget about it since all the people that were expecting that sidus versions , after being corrected, are going to produce results at least similar to the repainting version ended up in being disappointed.

Reason: