How do you convert your indicator to NON REPAINTING Indicator?

 
How do you convert your indicator to non repainting indicator?
 
Musngi:
How do you convert your indicator to non repainting indicator?
You code it so that once a buffer is given a value, it is not changed and that it does not give different values if it is re-initialised. (usually [0] can be changed )
 
Keith Watford:
You code it so that once a buffer is given a value, it is not changed and that it does not give different values if it is re-initialised. (usually [0] can be changed )
It means that I need to not use the current[0]? Should I use the closed bar or previous candle[1]? I'm really confused.
 
Musngi:
It means that I need to not use the current[0]? Should I use the closed bar or previous candle[1]? I'm really confused.

No, but as bar[0] hasn't closed, it is acceptable for it to repaint.

Many indicators repaint because they look at "future" bars.

ie when calculating the value for buffer [i] it uses values from bar[i-1] which is a "future" bar when [i] was current.


Of course with indicators such as Fractals, you know that a fractal cannot form until the following 2 bars have completed, so it will be painted 2 bars ago.

 

Hi friends , which lines of codes i have to change to get it convert to non-repaint , i attach file

Files:
 
khanatd:

Hi friends , which lines of codes i have to change to get it convert to non-repaint , i attach file

you cannot make a repainting indicator non repainting.

 
Jean Francois Le Bas:

you cannot make a repainting indicator non repainting.

Of course you can, but sometimes it is not worth it as an indicator may only seem to be good because of the repainting.

Keith Watford:
You code it so that once a buffer is given a value, it is not changed and that it does not give different values if it is re-initialised. (usually [0] can be changed )
Reason: