Why your indicator repaints - and how to check it in 5 minutes

Repainting indicators look perfect in history and useless in live trading.
Here is a check anyone can run without any tools.

1. Screenshot the last 20 signals today.
2. Wait for 3 new bars - do not reload the chart.
3. Screenshot again and compare.

If an arrow moved, disappeared, or appeared late, the indicator is calculated on
the forming bar. That is repainting.

The fix in code: evaluate the signal on the closed bar (i-1), never on the
forming one. In MQL5 that means reading buffers at index i only, with
rates_total - 2 as the newest usable bar, and returning rates_total so the
terminal recalcs incrementally instead of redrawing everything.

I convert repainting indicators into closed-bar versions: no repaint, arrows,
alerts and push notifications. If you have one that behaves like the example
above, send it over - I inspect it for free and tell you whether it can be fixed.

Xiangjun Jiang - MQL4/MQL5 developer
Xiangjun Jiang:
Repainting indicators look perfect in history and useless in live trading.

Any indicator can have a potential use. A real repainting indicator typically redraws buffers throughout history in an effort make that buffer history more relevant to current price. Generally that has a smoothing effect overall, such as a repainting parabolic channel for example. The fact that a human trader may have difficulty following it manually doesn't necessarily mean that it is useless. Any indicator, including a repainting indicator, can be called or embedded into an EA─thereby making its use/performance statistically trackable. That is to say that the Tester is capable of detecting where every repaint sat at every given time. And from that, a live trading strategy can be developed. At the end of the day, repainting versus non-repainting is not the make or break─it is performance in the way that it is used that matters.

Personally, I prefer to use non-repainting indicators too but that is no reason for me to poopoo repainting indicators.

Xiangjun Jiang:
If an arrow moved, disappeared, or appeared late, the indicator is calculated on
the forming bar. That is repainting.

Wrong. Real repainting is defined in my first paragraph, above. A currently forming bar is merely the inherent way in which every traditional price chart works─a fact of life, if you will. The alternative reality proposed would necessarily mean that every traditional price chart repaints, which is clearly not the case.

I appreciate your desire to help others, but please provide accurate information when you do so.