Why does my Pine Script indicator repaint after I reload the chart?

Indicators · Pine Script
SOURCE-CHECKED FIX Source checked Aug 12, 2026 TradingView documentation ✓
Short answer

The script is using information that behaves differently on open realtime bars and confirmed historical bars. Identify every unconfirmed value and higher-timeframe request, then decide whether the tool should wait for confirmed data or explicitly disclose realtime variation.

What you may be seeing

  • Signals move or disappear after refreshing the chart
  • Historical plots look different from what you saw live
  • An indicator appears accurate in history but changes on the realtime bar

Most likely causes

  1. The script uses information that is not confirmed until a realtime bar closes
  2. Historical and realtime executions receive different information
  3. Higher-timeframe or other requested data is used before it is confirmed

Try this first

  1. Identify which values can change during the open realtime bar
  2. Where appropriate, require confirmed-bar information before accepting a signal
  3. Review request.security or other timeframe requests for repainting behavior
  4. Reload and compare the script again before relying on the signal

If that didn’t fix it

  1. Use barstate.isconfirmed when waiting for a closed realtime bar is acceptable
  2. For alerts, consider triggering only after the bar closes
  3. Document intentional repainting if the script is designed to use live intrabar information

Verify the fix

Watch the indicator through a realtime bar, note its signal, then reload after that bar closes. The historical result should remain consistent with the confirmed logic you intended.

Why this happens

The script is using information that behaves differently on open realtime bars and confirmed historical bars. Identify every unconfirmed value and higher-timeframe request, then decide whether the tool should wait for confirmed data or explicitly disclose realtime variation.

Repainting is not one single bug. It can come from fluid realtime prices, future-leaking higher-timeframe requests, calculations that do not run consistently, or intentional plotting into the past.

Sources & next steps

Did this fix your problem? Your answer helps us rank fixes by real-world usefulness.
← Back to Resolve