← Blog
Indicators

Repainting: Why a Trading Signal Should Only Count After the Candle Closes

2026.06.13·5 min read·Rulyfi

Key Takeaways

  • Repainting is when a signal that appeared while a candle was still forming disappears or changes once the candle closes.
  • It is look-ahead bias happening on a live chart: both act on information that is not yet final.
  • How to prevent it: evaluate signals only after the candle closes. A closed candle's signal never changes again.

Have you ever seen a "buy" arrow appear on a live chart, then quietly vanish the moment the candle closed? That is repainting. If you entered on that signal, you traded on something that never really existed. The fix is simple: wait for the candle to close. This article covers what repainting is, why it fools you, and how to prevent it. (The same mistake inside a backtest is covered in Your Crypto Backtest Is Lying to You.)

1. What is repainting?

Repainting is when an indicator value or signal on an already-formed bar changes after the fact. TradingView's own documentation defines it as plots changing when a script calculates on real-time bars and the page is then refreshed.1 The most common form is a signal arrow that appears while a candle is still forming, then disappears as the candle closes.

2. Why it fools you

The price of a candle that is still forming is not final. When a signal fires off that unconfirmed price, it can vanish as the price moves and the candle closes. The problem is that you see and act on that signal in real time. Look at the chart afterward and there is no trace of it.

This is look-ahead bias on a live chart, the same disease covered in Your Crypto Backtest Is Lying to You. The CFA curriculum defines look-ahead bias as using information that was not actually available during the period being tested.2 Marcos López de Prado, working in financial machine learning, generalizes it as a form of data leakage, where future information seeps into the decision.3 Repainting is that leakage happening on a live chart: in a backtest you use an unclosed bar's close ahead of time; live, you follow that unconfirmed bar's signal.

3. How to spot it

  • Does a signal arrow flicker or shift position while the candle is still forming?
  • When you scroll back, did the indicator catch tops and bottoms a little too perfectly?
  • Do the same strategy's backtest signals sit in different places than its live signals?

If any of these is true, suspect repainting.

4. How to prevent it

The guidance in TradingView's documentation converges on one rule: use only closed bars.4

  • Evaluate a signal only at the bar's close (barstate.isconfirmed).
  • Configure alerts to fire after the bar closes (alert.freq_once_per_bar_close).
  • Read the last closed bar's value (close[1]), not the current one.

The principle is identical to backtesting: use only the information that was actually available at the moment of execution. (Rulyfi's scanner and bot evaluate every signal on closed bars.)

At a glance

FormSymptomHow to prevent
Mid-candle signalArrow flickers or movesEvaluate only after the bar closes
After-the-fact changePast values shift on refreshUse the closed bar's value (close[1])
Early alertAlert fires mid-candle, then cancelsFire alerts after the bar closes

A one-bar delay beats a phantom signal

Waiting for the candle to close means your signal arrives one bar later. But that delay beats trading on a signal that was never there. Only a closed bar's signal is a real signal that will not change again. In a backtest or live, the principle is the same: use only what you could actually have known at the time.

Frequently asked questions

What is a non-repainting indicator? One that uses only closed-bar data, so a past signal, once drawn, does not change later.

Doesn't waiting for the candle close make me too late? You are trading a one-bar delay for a real signal instead of a vanishing one. A confirmed signal one bar later is more reliable than an entry on a signal that will disappear.

Does repainting happen in backtests too? In a backtest it is called look-ahead bias. Same disease, different stage: repainting on a live chart, look-ahead in the backtest.


Auto-trading and trading carry a risk of losing your principal. This article is educational, does not guarantee profit, and past backtest results do not predict future returns.

Footnotes

  1. TradingView, "Script or strategy gives different results after refreshing the page (repainting)".

  2. AnalystPrep (CFA Level 2), "Problems in Backtesting and Biases in Data".

  3. Marcos López de Prado, "Purged cross-validation" (2017).

  4. TradingView Pine Script Docs, "Bar states" (barstate.isconfirmed).

repaintingclosed-candlelook-ahead-bias