Does your Pine Script repaint?
Paste your code. See every repaint risk and its fix.
Likely repaints
- Higher TFHTF2 found
- Realtimeclean
- Alertsclean
- Fills1 found
- Visualsclean
Static check. Confirm with Bar Replay
Skip the debugging: see our 8 strategies liveAll 8 of our strategies
- Once per bar, closed bars only
- No look-ahead
- Past trades never change
- 1,473+ traders already on board
- 30-day money-back
- Instant access
We checked the most popular TradingView strategies.
The most-boosted open-source strategies, run through this checker.
- With a look-ahead risk
- 1 %
- With a repaint risk
- 18 %
- Most common
- Higher timeframe without
[1]
The Daily filter example in TradingView's Strategy Tester
- With look-ahead
- +141.5 %
- Fixed with
[1] - +52.9 %
What repainting means on TradingView.
Repainting is when a script's past signals or values differ from what it showed live. History is calculated on closed bars, the live bar tick by tick, so a reload shows signals that never fired and backtests live trading can't repeat.
The live bar moves
Normal. Every indicator does it until the bar closes.
Past signals change
Repaints. A reload shows other signals than live.
History sees the future
Looks ahead. The backtest uses later data.
Does your indicator repaint?
As they are usually coded. Paste a script to check yours.
- RSINoFixed once the bar closes
- MACDNoFixed once the bar closes
- StochasticNoFixed once the bar closes
- Moving averagesNoFixed once the bar closes
- SupertrendNoA flip counts at the close
- FractalsDrawn backKnown 2 bars later
- Pivot pointsDrawn backKnown several bars later
- ZigZagYesThe last leg redraws
- Renko-basedYesThe last brick redraws
- Multi-timeframeDependsSafe only with a
[1]offset
How to fix repainting in Pine Script.
Three changes solve most cases.
Higher timeframe: last closed bar
Beforerequest.security(sym, "D", close)Afterrequest.security(sym, "D", close[1], lookahead = barmerge.lookahead_on)Orders: act on closed bars only
Beforeif ta.crossover(fast, slow)Afterif ta.crossover(fast, slow) and barstate.isconfirmedAlerts: fire once per bar close
Beforealert("Long")Afteralert("Long", alert.freq_once_per_bar_close)
How to check if an indicator repaints.
Bar Replay shows what a script really does.
Open Bar Replay. Start 200 bars back.
Step forward. Watch each signal at the close.
A signal that moves or vanishes repaints.
Every repaint and lookahead pattern we flag.
Worst first. The checker shows each with its lines and the fix.
lookahead_onwithout[1]- Pine v1–v2
security() request.earningsand others withlookahead_on- Strategy on a Renko or brick chart
- Higher timeframe without
[1] lookahead_onwith an unclear offsetcalc_on_every_tick = truevaripin ordersbarstate.isrealtime,islast,isnewin orderstimenowin logic- Strategy on Heikin Ashi, no standard fills
ticker.renko()data in orders- Alerts before the bar closes
process_orders_on_close = truecalc_on_order_fills = true- Target, stop or trail in one bar
- Price values in tick inputs (
trail_offset,loss…) - No commission or slippage
- Indicator on a Heikin Ashi chart
- Lower timeframe via
request.security chart.is_heikinashiand similarplot(…, offset = -n)- Pivot drawn at the pivot bar
Pine Script repainting FAQ.
What is repainting in TradingView?
A script repaints when its past signals change after the fact. History is calculated on closed bars, live bars tick by tick, and the two don't match.
How do I know if an indicator repaints?
Paste its code into the checker to find the likely lines. Then confirm with Bar Replay: a signal that moves or vanishes after its bar closes repaints.
Is repainting always bad?
No. The open bar always moves, and a ZigZag redraws by design. It matters when orders, alerts or backtests use values that change later.
What is lookahead bias in Pine Script?
The backtest uses data that did not exist yet at that bar. The classic case: request.security with lookahead_on and no one-bar offset. Great results, all invalid.
How do I avoid repainting in Pine Script?
Use closed-bar values only: shift higher-timeframe data one bar back with lookahead_on, gate orders with barstate.isconfirmed, and fire alerts once per bar close.
Does a non-repainting indicator lag?
By up to one bar. It waits for the close, so a signal comes a little later, but it never changes afterwards.
What does TradingView's repainting warning mean?
TradingView warns in the alert dialog when a script may repaint. It is a quick guess that also fires on harmless code. The checker shows the exact lines.
Does a tick chart stop repainting?
No. Repainting comes from the script's logic, not from the chart. Fix the code, then confirm with Bar Replay.
Is my code uploaded?
No. The check runs in your browser. Your code is never sent to us or anyone else.

