Download MetaTrader 5
To add comments, please log in or register
Sell your CPU capacity and earn money!
Musngi
303
Musngi 2016.11.18 04:19 
How do you convert your indicator to non repainting indicator?
Keith Watford
Moderator
9544
Keith Watford 2016.11.18 05:03  
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
303
Musngi 2016.11.18 05:27  
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
9544
Keith Watford 2016.11.18 05:42  
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