Trading Indicator
Repainting
Last Update: May 5, 2024
What is Trading Indicator Repainting in the world of Pine Script -
And how do WE deal with it?
Who better to learn it from than the developers of Pine Script, the official TradingView script language. PineCoders wrote a post about Repainting. We summarize the three types of Repainting below and explain our approach.
Here we answer:
What is trading indicator repainting?
Indicators and signals that change on the current or past bars.
What types/causes of indicator repainting exist?
1. Using data from incomplete bars on a higher time frame.
2. Using a negative offset parameter to draw signals in the past.
3. Signals that change during a real-time bar.
Will using the security() function in Pine Script always cause repainting?
Not necessarily. Indicator repainting can be avoided when using the security() function only on completed bars from higher time frames.
Type of Repainting
Our Comments
1. An indicator that uses future data not yet available on historical bars. Well, It’s not actually future data (no time travel yet, sorry), but what is meant here is using data from higher time frames and using it as if it was from a completed candle, even though it may be from only half-way through a 30-minute bar.
Mistakes can happen, but that’s a bad one. Of course, you don’t want to see where a nice signal would have been a few candles later. We wonder, what’s the point? It goes without saying that we don’t use future information in our indicators. But we just said it anyway. Full disclosure, we do use the security() function, but only on closed bars from higher timeframes and for screeners to scan for signals on multiple stocks. None of that will negatively affect our indicators. So when you create an Alert and see a repainting warning, it’s safe to ignore. But please read all the way down.
2. An indicator that uses a negative offset parameter when plotting in order to plot information on past bars.
We feel this one is just plain cheating. This type of indicator is plotting a buy or sell signal a few bars back, which hasn’t been there when the bar was actually completed. Doesn’t sound right, does it!? Without a shadow of a doubt, none of our indicators do this.
3. An indicator showing results that change during the real-time bar, whether the script is using the security() function or not. So while the price is still moving up and down within a given bar, a signal may appear and disappear until the bar is closed.
Our OMEGA indicator plots buy ‘▲‘ and sell ‘▼‘ signals right above and below the chart. For some bars, like hourly, daily and higher time frame bars we don’t want to have to wait until the bar closes to get a signal, and we believe many of our users don’t either. We allow users to choose at which minimum percentage of progression during a live candle/bar a signal can be triggered. For example, you can set that signal can be triggered after 30%, 70%, 93% or 100% of the bar have been completed. We believe this is a unique feature that makes it possible for traders to execute on a signal at the end of the trading day for example, instead of having to wait until the next. Of course, that is a decision each trader has to make for him- or herself.
If you want to prevent this from triggering lots of alerts, simply set it to 100. Alternatively, you can set the TradingView alert trigger to ‘Only Once’ or ‘Once Per Bar Close’ and ignore visual signals on the chart until the bar is closed.
We are going to great lengths to ensure our trading indicators aren’t repainted accidentally, but only with permission from you. Happy Trading!
If you want to learn more about our expert trading indicators and signals for professional and beginning traders, please visit our indicator information page here.