How to Avoid Repainting in Pine Script: A Practical ChecklistBitcoin / U.S. dollarBITSTAMP:BTCUSDPineifyRepainting is not one bug. It is a family of behaviors that can make historical signals look cleaner than the signals a trader could have seen in real time. Before trusting any Pine Script indicator or strategy, use this checklist. 1. Separate confirmed data from developing data On a live bar, high, low, and close can change before the bar closes. A condition that is true halfway through the bar may be false at the close. If an alert or entry is meant to act only after confirmation, design and test it around closed-bar values. A simple test: replay the script bar by bar and compare the signal visible during the live bar with the signal remaining after the bar closes. If they differ, document that behavior instead of treating the historical result as final. 2. Audit higher-timeframe requests Higher-timeframe data is a common source of accidental lookahead. Check every request for: • the requested timeframe; • whether the value belongs to a completed higher-timeframe bar; • whether the merge behavior can expose a value before that higher-timeframe bar has closed. The important question is not “does the chart look smooth?” It is “could this exact value have been known at the moment the signal appeared?” 3. Treat pivots and swing points as delayed information Pivot and fractal functions often need bars to the right before a turning point can be confirmed. The marker may be drawn at the earlier pivot location, but the confirmation arrives later. That is not automatically wrong, but it must be represented as delayed information. When reviewing a script, ask: • When is the pivot confirmed? • Where is the marker plotted? • When can an alert actually fire? • Does the backtest enter at confirmation or at the historical pivot location? 4. Test the realtime path, not only the historical chart A reliable validation routine includes: • Bar Replay with the script stepping forward one bar at a time; • a live market session with alerts logged; • reload and timeframe-change checks; • comparison of signals before and after the bar closes; • a review of any drawings that move, disappear, or change position. Keep screenshots or logs of the test. A script that passes only a static historical inspection has not yet passed a repainting review. 5. State the limitation clearly “Non-repainting” should describe a defined behavior, not serve as a marketing label. A precise description might say: • signals are evaluated on confirmed bars; • higher-timeframe values use completed bars; • pivot markers appear only after confirmation; • intrabar alerts may change before bar close. That level of detail lets other traders choose settings that match their execution style. The goal is not to eliminate every moving value from a chart. The goal is to distinguish information available now from information revealed later, then make the script and its documentation consistent with that distinction. Educational note: this checklist is for script validation and research, not financial advice or a trading signal.