Have you ever heard of the word repainting and wondered what it is? Lets have a look and try to understand the implications of repainting better.
What is repainting?
Repainting is a phenomenon in which the indicator changes its stance when it gets new information and replaces old drawings or paints with new ones. Repainting can happen for multiple reasons.
- It is possible that the indicator is supposed to repaint as a concept
- Usage of some pine constructs causes indicator repainting - such as request.security(), using real-time unconfirmed data for generating signals.
- Author has intentionally implemented them with caution of not impacting the overall outcome.
Is Repainting Bad?
Short Answer - No. Repainting is not always bad.
Long Answer - Some indicators are supposed to repaint by design. For example, the last pivot of Zigzag always repaint based on the latest OHLC data. Our premium indicators implement - "Safe repainting" as a feature which implies that repainting is done on visuals without impacting the outcome of the indicator. These instances are normal and are not inherently bad for indicators and their usage.
Having said that, it is possible that the author has knowingly or unknowingly used certain constructs of pine that are known to cause repainting and it impacts the way indicators display and present over the period of time and misleads the users. Such repaints are bad for the users and should avoid using such indicators.
How to identify repainting?
The simple way to find out if an indicator repaints or not is by testing it. We can do
Forward testing with Alerts: Set alerts and run the indicator. Match the alerts with the indicator signals to see if there is a discrepancy. Using smaller timeframes so that your testing time is reduced.
Using Bar Replay: Forward testing may be time-consuming even if we use lower timeframes. And we may not be able to use a lower timeframe for certain tests. In such cases using Tradingview's bar replay feature is very useful.
Here is another article from tradingview on indicator repainting
The below short video contains a demonstration of repainting on charts.