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 )
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
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.
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.
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 )
the current unclosed bar is always changing, so you can't process it if you want to avoid repaint, you could either ignore current bar in the indicator calculation loop or else use the open price of the current bar instead of close price (open prices don't move...)
some things are also non-repainting in nature like momentum, and momentum indicators naturally don't repaint
[A]s bar[0] hasn't closed, it is acceptable for it to repaint.
To each her/his own I suppose but IMHO, every indicator that draws bar 0 (the currently forming price bar) and does not redraw any previous bars is not "repainting." Any trader who is unhappy with bar 0 of an indicator being redrawn is inherently unhappy with the way that every trading platform on the planet draws price bar 0 on a chart by default.
As others have mentioned previously in this thread, such an unhappy trader can generally edit an indicator loop, or the bar references therein, to reference bar 1 (in the case of iterating in reverse chronological order). Just be aware, that this will knock indicator bars out of alignment with price bars by one bar. To correct that, the indicator's drawing should be shifted back one bar.
As a side note, truly repainting indicators generally redraw history for a reason. That reason could be the premise that reanalysis of the entire lookback period provides less lag and higher responsiveness, or the fact that the drawing of the indicator necessitates redrawing of the entire lookback period. For example, a smoothly curved parabolic channel indicator must redraw the entire channel in order to preserve its foundation─a smooth parabolic curve. Furthermore, waiting for a new such channel to form based on only new bars would destroy the indicator's responsiveness. This are the reasons that "non-painting versions" of the ZigZag indicator, for example, end up being entirely different indicators, e.g., based on Fractals, LSMA, etc.
Even so, I find that redrawing and non-redrawing indicators are not so diametrically opposed. In fact, they tend to complement each other when combined in a strategy.
Before you say that redrawing indicators can't be tested, please think again. Run them through the Tester or, better yet, incorporate them into an EA and run that through the Tester. Voila!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use