Articles What is repainting in TradingView and how do I find it and avoid it?

Mike Christensen Mike Christensen

Mike Christensen

Repainting is a Pine Script behavior in TradingView causing historical vs real-time calculations or plots to behave differently. It is widespread and can be caused by many factors. Most existing indicators repaint, including widely used indicators like MACD and RSI. TradingView’s documentation states that, “[...] our estimate is that more than 95% of indicators in existence repaint.”

Why does it matter? Because repainting can mean that trades are taken that the backtest never shows and real-world performance can vary wildly from what the backtest reports is possible.

The different types of repainting can be divided into four categories: (1) recalculation during the real-time bar, (2) misleading plotting in the past, (3) unacceptable use of future information, and (4) unavoidable revision of historical feeds or varying starting bar on historical bars.

Recalculation during the real-time bar is often acceptable if users understand how it works and if the script's behavior meets their requirements. Misleading plotting in the past and other types of unacceptable repainting behaviors should be avoided.

Fake indicators, strategies, and trading systems that claim to have 90-100% win rates are common. They take advantage of a feature that allows the indicator or strategy to get future price data. This is known as a "repainting" strategy.

The easiest way to tell if there is any repainting going on is to use the "replay" feature in TradingView. Otherwise, an analysis of the Pine Script is needed to determine if repainting will occur. Things to look out for include lookahead and security functions.

Another way to check for repainting, if you don’t have the bar replay tool, is to set up the strategy with TradersPost and watch the trades come through. If a trade was executed and shows up in TradersPost, but suddenly disappears from the TradingView window after the fact, then you have a repainting issue.

Unfortunately, there is not much you can do about a strategy that repaints if written by another user. It is recommended to learn how to create your own strategy from scratch to gain a better understanding of the principles in play.

Still unsure if your strategy or indicator repaints? Join us on Discord and share your TradingView URL.

Are you ready to start automating your trading? Start your free account today.