Download MetaTrader 5

How do you convert your indicator to NON REPAINTING Indicator?

To add comments, please log in or register
Musngi
299
Musngi  
How do you convert your indicator to non repainting indicator?
Keith Watford
Moderator
10561
Keith Watford  
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 )
Musngi
299
Musngi  
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.
Keith Watford
Moderator
10561
Keith Watford  
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.

To add comments, please log in or register