Quant Concepts · Vol 7 of 8
Non-repainting indicators: what the label promises, and how to check it
Why a past bar can show a signal it never showed live, which kinds of repainting mislead, why a clean label is no proof of an edge, and how to check an indicator yourself.
The short answer
A non-repainting indicator shows the same values and signals on closed bars that it showed while those bars were live. The bar that is still forming can change until it closes. Stability alone does not rule out late signals, a rule with no edge or optimistic backtest fills. Most checks compare a chart's history with what it showed live.
Key ideas
- Non-repainting means closed bars look the way they looked live. TradingView's manual counts any difference between history and live bars as repainting, including a value that moves before its bar closes, and estimates that "more than 95% of indicators" do it in some form.
- Marks drawn back in time and future data on past bars are the two kinds that mislead. In this article's simulation, 10-bar trades bought at a marker drawn on a price low won 80% of the time (median of 2,000 paths); bought five bars later, when that low could first be known, they won 50%.
- A stable signal says nothing about edge. On simulated prices with no edge, a filter that peeked at the day's close turned $10,000 into a median $186,717 across 2,000 paths. Its confirmed, non-repainting version ended at a median $9,929, the correct result for those prices.
What does repainting mean?
A bar is one period of price on a chart, with its open, high, low and close. The live bar is the one still forming; a closed bar is final. A signal is the arrow, dot or label a script draws when its condition is true.
TradingView's Pine Script manual defines repainting as "script behavior causing historical vs realtime calculations or plots to behave differently", and estimates that "more than 95% of indicators in existence exhibit some form of repainting behavior." A Google result for "non repainting indicator", from an indicator download site, says the opposite: "Most technical indicators are non-repainting." Both hold under their own definitions: the manual counts a value that moves on the live bar, where RSI and MACD "fluctuate on a realtime, unconfirmed chart bar until it closes", while that site counts only closed bars that change later.
The manual sorts repainting into four groups and notes that not all of it is "inherently useless or misleading":
- The live bar moves until it closes. RSI, MACD and moving averages change on the forming bar and stay fixed once it closes. In the manual's terms this is "widespread but often acceptable"; it still matters for alerts, which fire on live bars.
- Future data lands on a past bar. A daily value requested the leaky way shows the day's final close on hourly bars that came before it. The manual rates it "unacceptable", and TradingView's publishing rules bar the leaky request from public scripts.
- A mark is placed back on an earlier bar. Pivots, fractals and ZigZag points are only known some bars after the turn. Drawn back on the turning bar, the history shows a signal at a time when nobody could see it. The manual files plotting into the past under "potentially misleading".
- History reloads differently. A chart's first bar depends on the account plan and the timeframe, values such as an EMA "vary with early history", and data feeds sometimes adjust elapsed bars. The manual's name for this group is "unavoidable".
One Google AI Overview lists "moving averages" among tools that "naturally update their past curves as new data arrives." On closed bars a moving average does not move, apart from the start-point effect of the fourth kind.
How can a past signal look better than it was?
A pivot drawn on the low
In this simulation, a pivot low has a lower close than the five bars before and after it. This close-based version, ta.pivotlow(close, 5, 5) in Pine, can only be confirmed five bars after the low. The manual describes what scripts then do: they "go back in the past to plot pivot levels or values on the actual pivot, 5 bars in the past", and "The display looks great, but it can be misleading."
The simulation's 2,000 paths of 2,000 daily bars each are random walks with a daily volatility of 2% and no edge. Each pivot low gets two trades held for 10 bars: one bought at the close of the pivot bar, where the marker sits, and one bought five bars later, when the pivot could first be known.
Show the numbers
| Pivot in the window | Day drawn | Day known | Price rise by the day known | 10-day trade bought at the marker | 10-day trade bought when known |
|---|---|---|---|---|---|
| 1 | 2 | 7 | +4.0% | +7.2% | +10.7% |
| 2 | 29 | 34 | +5.7% | +6.7% | −1.6% |
| 3 | 38 | 43 | +0.3% | −6.3% | −11.7% |
| 4 | 55 | 60 | +3.3% | +11.8% | +11.0% |
| 5 | 88 | 93 | +6.3% | +8.6% | +10.4% |
| Across 2,000 simulated paths | Median (10th to 90th percentile) |
|---|---|
| Winning trades, bought at the marker | 80% (76% to 85%) |
| Winning trades, bought when the pivot was known | 50% (44% to 56%) |
| Average trade, bought at the marker | +4.8% (+4.2% to +5.5%) |
| Average trade, bought when the pivot was known | +0.2% (−0.6% to +1.0%) |
| Average rise from the pivot's close to the confirming close | +4.7% (+4.4% to +5.1%) |
| Mean log rise divided by daily volatility | 2.3 (2.1 to 2.5) |
| Pivot lows per 2,000-day path | 120 (113 to 127) |
The average trade made +4.8% bought at the marker and +0.2% bought when the pivot was known, close to zero as prices with no edge imply. By the confirming bar the price had already risen 4.7% on average, about 2.3 times the daily volatility, so a trade bought live started after that rise. Each win rate rests on about 120 trades a path and carries the error bar Vol 1 puts on any win rate.
TradingView's page on the Williams Fractal says the indicator "lags and does not have the ability to redraw", and a forum thread asks, "How are fractals repainting? ... It is formed after two next candles close". The mark never redraws, yet it sits two bars before the bar on which it appeared.
A peek at the day's close
The textbook leak, as the trading blog Robot Wealth describes it, is an intraday trade decided on the day's close, which nobody knows until the day ends. In TradingView it appears when a script on an hourly chart requests a daily value with lookahead_on and no offset: on history the request returns final values "before they are actually available on historical bars", while on the live bar "no lookahead is possible in realtime because the future there is unknown."
The second experiment rebuilt that case on 2,000 paths of 1,000 days, each day 24 hourly bars, with a daily volatility of 2% and no edge. The filter is a daily close above its 20-day average. At the close of each day's first hourly bar, 23 hours before the close that sets the filter, the rule buys if the filter is on and sells at the day's close. The filter is read three ways: with the peek, as it looked live (the first hour's price standing in for the close), and confirmed on the previous day's close.
Show the numbers
| Version of the filter | This path: final value | This path: winning days | This path: days held | 2,000 paths: final value, median (10th to 90th) | 2,000 paths: winning days | 2,000 paths: average per day held (basis points) |
|---|---|---|---|---|---|---|
| History with the peek | $221,987 | 62% | 522 | $186,717 ($116,204 to $294,798) | 62% (60% to 64%) | +60.6 (+55.2 to +66.1) |
| As it looked live | $12,444 | 51% | 527 | $9,970 ($5,826 to $17,449) | 50% (47% to 53%) | +1.8 (−10.0 to +12.3) |
| Confirmed, non-repainting | $10,999 | 50% | 521 | $9,929 ($5,823 to $17,823) | 50% (47% to 53%) | +1.7 (−10.1 to +12.4) |
Across 2,000 paths, the history with the peek ended above $10,000 in every path; the lowest was $43,856. As it looked live, the filter ended at a median $9,970, and confirmed at $9,929, each with 50% winning days. The peek and the live reading disagreed on only 12.2% of days, the days on which the price move after the first hour changed the filter's answer.
The documented fix requests the previous bar's value, close[1], with lookahead_on, which "always uses the last confirmed value from the higher timeframe"; the manual calls it "the only recommended method to avoid repainting." A Google AI Overview says the default setting, lookahead_off, "behaves consistently between historical backtests and live/real-time trading." The manual disagrees: both the default and the leaky call change after a reload, because "the elapsed realtime bars from the previous run become historical bars in the new run."
Why is non-repainting not the same as good?
It arrives later. The manual's fixes for live-bar repainting wait for the bar to close or use the previous bar, and "while they prevent repainting, they will also trigger signals later than repainting scripts. This is an inevitable compromise if one wants to avoid repainting." A confirmed pivot is five bars late by definition, and in the simulation those five bars held a 4.7% rise on average.
It creates no edge. The confirmed filter in Figure 2 ended near $10,000 because the prices had no edge to find. FXGlory, a rare page-1 result that separates the two ideas, writes: "Signal stability and signal quality are different questions: a fixed historical signal can still be late or wrong."
A backtest can flatter a stable rule in other ways. The rule can be tuned to noise, the subject of Vol 2. It can fail on data it never saw; the manual notes that "A strategy that suffers from overfitting often fails to perform well on new, unseen data," and Vol 3 covers that test, along with a published moving-average result that a look-ahead leak had inflated. TradingView's strategy simulator guesses the path of price inside each historical bar, and settings that recalculate within a bar or fill on the bar's own close change what the backtest shows. The manual's FAQ says that "If strategies repaint, their backtesting results are not reliable because they do not accurately represent the strategy's behavior in realtime."
How can a trader check an indicator?
Each check catches some of the four kinds in Figure 3 and misses others.
Show the numbers
| Kind (label on the image) | What happens | Group in TradingView's manual | Flagged on the image |
|---|---|---|---|
| The live bar moves until it closes | RSI, MACD or an average move on the forming bar | widespread but often acceptable | no |
| Future data lands on a past bar | A day's close shows up on bars before it happened | unacceptable | yes |
| A mark is placed back on an earlier bar | A pivot known 5 bars later, drawn on the low | potentially misleading | yes |
| History reloads differently | A different first bar or revised data changes values | unavoidable | no |
- Watching one signal through its bar's close. The manual asks: "Do signal markers shown by the script wait for the end of a realtime bar before showing?" A marker that appears and vanishes inside a bar belongs to the first kind; the documented way for a script to wait is
barstate.isconfirmed. Watching the forming bar alone cannot rule out future leaks or marks added later to earlier bars. - A screenshot, then a reload. After a reload, the bars that were live become history, and a daily request, leaky or default, changes at that point. Comparing the old screenshot with the reloaded chart also shows marks that appeared later on bars that had none. This catches the second and third kinds, but only on bars that were live while the trader watched.
- The alert log against the chart. Alerts fire on live bars, and the manual's FAQ says: "If an alert fires at a different time than expected, repainting might be the cause." With an active alert for the same condition and settings, a chart mark without a matching alert is a reason to investigate leaks or back-placed marks.
- A forward test. The manual's own test for lookahead bias, future data on past bars, is forward testing "on realtime data, where no known data exists beyond the latest bar". Bar Replay can stand in for waiting, with limits: TradingView's help describes it as a practice tool ("Bar replay allows you to simulate past price movements for strategy testing") without mentioning repainting, and does not document whether a script's daily requests behave in replay as on a live bar.
- The description and the settings. TradingView's publishing rules say that "if your script offsets plots into the past, the description should explain that behavior." With the code open, a higher-timeframe request with
lookahead_onand no[1]offset is the documented leak, and a strategy set to recalculate on every tick can change its fills. - The manual's questions. "Simply asking whether a script repaints is relatively meaningless," the manual says. Its list asks narrower things, such as "Do alerts from the script wait for the end of a realtime bar before triggering?" and "Does the script plot/draw values into the past?"
What do the research and the platform say?
- Live data exposes a leak. "Because there is no future data to leak into the past on realtime bars, the strategy will behave differently on historical and realtime bars if it is affected by lookahead bias," the manual's strategy notes say.
- A leak can make a known rule look exceptional. Zakamulin (2018) found that a published moving-average strategy's "too good to be true" performance came from "simulating trading with look-ahead bias"; fixed, it was "indistinguishable from the performance of the buy-and-hold strategy."
- MetaTrader warns about one of its own tools. Its help says of ZigZag that "the last segment of the indicator may change depending on new incoming data" and that "it should not be used as the basis for a trading system."
Common mistakes
- Reading a mark on the turning bar as a signal available at that bar. In the simulation, trades bought at the marker won 80% of the time; bought when the pivot was known, 50%.
- Reading a non-repainting label as evidence of an edge. The confirmed filter in Figure 2 ended at a median $9,929 from $10,000.
- Treating
lookahead_offas the whole fix. The default request also changes after a reload. - Checking only on history. A leak looks like skill on historical bars and only shows when the bars arrive live.
- Judging a strategy without its fill settings. Recalculating inside a bar or filling on the bar's own close changes the backtest.
Rule of thumb
A signal counts from the bar on which it could first be seen.
Sources
All accessed 2026-11-15.
- TradingView. Pine Script User Manual, "Repainting." https://www.tradingview.com/pine-script-docs/concepts/repainting/
- TradingView. Pine Script User Manual, "Other timeframes and data." https://www.tradingview.com/pine-script-docs/concepts/other-timeframes-and-data/
- TradingView. Pine Script User Manual, "Bar states." https://www.tradingview.com/pine-script-docs/concepts/bar-states/
- TradingView. Pine Script User Manual, "Strategies." https://www.tradingview.com/pine-script-docs/concepts/strategies/
- TradingView. Pine Script User Manual, FAQ, "Alerts." https://www.tradingview.com/pine-script-docs/faq/alerts/
- TradingView. Pine Script User Manual, FAQ, "Strategies." https://www.tradingview.com/pine-script-docs/faq/strategies/
- TradingView Help Center. "Script Publishing Rules." https://www.tradingview.com/support/solutions/43000590599-script-publishing-rules/
- TradingView Help Center. "Bar Replay: how and why to test a strategy in the past." https://www.tradingview.com/support/solutions/43000712747-bar-replay-how-and-why-to-test-a-strategy-in-the-past/
- TradingView Help Center. "How to select replay interval for the Bar Replay." https://www.tradingview.com/support/solutions/43000739158-how-to-select-replay-interval-for-the-bar-replay/
- TradingView Help Center. "Williams Fractal indicator." https://www.tradingview.com/support/solutions/43000591663-williams-fractal-indicator/
- Zakamulin, V. (2018). "Revisiting the Profitability of Market Timing with Moving Averages." International Review of Finance 18(2), 317-327. https://doi.org/10.1111/irfi.12132
- MetaTrader 5 Help. "ZigZag." https://www.metatrader5.com/en/mobile-trading/android/help/chart/indicators/trend_indicators/zigzag
- Robot Wealth. "Backtesting Bias: Feels Good, Until You Blow Up." https://robotwealth.com/backtesting-bias-feels-good-until-you-blow-up/
- FXGlory. "Non-Repaint Indicator: Meaning, Examples & Tests." https://fxglory.com/learn/technical-analysis-forex/forex-technical-indicators/non-repainting-forex-indicators/
- Forex Factory. "Any non-repaint indicators that work well trading forex." https://www.forexfactory.com/thread/500840-any-non-repaint-indicators-that-work-well-trading-forex
- Google search results and AI Overviews for "non repainting indicator", "what is repainting tradingview" and "lookahead_on request.security", captured 2026-11-15, including the EarnForex result they list (https://www.earnforex.com/indicators/non-repainting/).
Simulations: computed for this article from synthetic data (no market data). Code, seeds and outputs are kept with the article's research pack.