Repainting Indicators: What Redraws, and When It Matters
An indicator that changes its own past is a serious problem, and an indicator whose last value moves while the current candle is still forming is not a problem at all. Both get called repainting, and the word covers at least three separate behaviours with three different consequences.
The platform documentation is clearer on this than the discussion around it. One charting vendor publishes a definition and splits the causes apart; MetaQuotes documents, for MetaTrader, the exact argument that decides whether an indicator recalculates its history or only its newest bar.
Key takeaways
- The unclosed bar on the right of the chart has moving values by definition, so a reading taken from it moves too.
- The behaviour worth objecting to is a value on an already closed bar changing after the fact.
- TradingView documentation separates three causes and states that not every one of them is misleading.
- On MetaTrader, whether an indicator recalculates old bars is decided in its code by how it uses prev_calculated or IndicatorCounted, not by a setting on screen.
- No vendor publishes a specification for the phrase non-repainting, so the label alone says nothing about which behaviour is excluded.
- Two reloads and one closed-bar comparison settle the question on your own chart in a few minutes.
Table of contents
What Changes on a Chart, and When
A chart holds two populations of bars that behave differently. Everything to the left of the rightmost bar is closed: its open, high, low and close are settled and will not move again. The rightmost bar is still being built, and three of those four values can change with every quote that arrives until the period ends.
Any indicator reading from that bar inherits the movement. A moving average whose newest point uses the current close will shift as the close shifts. A channel whose upper edge tracks the highest high will step up the moment a new high prints. Nothing has gone wrong in either case; the input changed and the output followed.
The behaviour worth objecting to is different in kind. It is a value on a bar that closed hours ago being different when you look again, so a signal you could see in the history was never available at the time it appears to have fired. The distance between those two situations is the whole subject, and it is why waiting for a bar to close before acting removes one of them entirely and does nothing about the other.
Keeping the two apart also decides what a chart is worth as evidence. A backtest or a visual review reads history as though it were the record of what was on screen at the time, and only the second behaviour breaks that assumption.
Three Different Behaviours Share One Name
TradingView publishes a definition in its Pine Script documentation: repainting is script behaviour where the historical calculation or plot differs from the realtime one. That framing puts the emphasis where it belongs, on a difference between two modes rather than on redrawing as such.
The same documentation separates the causes into three groups. One is the gap between how a script computes on confirmed bars and on the unconfirmed bar. One is plotting a value backwards onto an earlier bar once something has been detected. One is variation in the underlying dataset, where a different starting point or a revised feed produces different numbers from the same script.
It also states directly that repainting behaviour is not inherently useless or misleading, and notes that a large majority of indicators show some form of it, including ones nobody treats as suspect. That is a vendor describing its own platform, and it is a more careful position than the version that circulates in forums.
The third cause is the one readers meet without recognising it. An indicator with a long lookback needs a run of bars before its first valid value, so the bar the calculation starts from changes what the earliest outputs are. Load a chart with more history than you had yesterday and those early values move, without a line of the code having changed.
Feed corrections do the same thing from the other direction. Where a data provider revises a bar after the fact, every value computed from it changes with it, and an indicator that never plots backwards will still show a different history than it showed before. Neither case is a fault in the script, and neither is visible unless the two versions are compared deliberately.
| Behaviour | What moves | Does a closed bar change | What it costs the reader |
|---|---|---|---|
| Realtime bar differs from historical | the newest value, until the bar closes | no | an intrabar signal can disappear before the close |
| Plotting into the past | values placed on earlier bars after detection | yes | history shows signals that were not available then |
| Dataset variation | the numbers themselves, between loads | yes | two screens disagree and neither is reproducible |
What prev_calculated Actually Controls
MetaTrader answers the same question through a different mechanism, and it is documented rather than inferred. An indicator there is not redrawn by the terminal on a whim: it is called, handed a count, and left to decide what to do with it.
In MQL5 the calculation runs inside OnCalculate, which receives the size of the input series along with a second figure that MetaQuotes documents as a count of the bars already handled when the function was last called.
An indicator that begins its loop at that figure touches only what is new. One that ignores it and walks the whole series recomputes every bar it holds, on every tick, and is free to write a different value into a bar that closed last week.
MQL4 exposes the same idea as a function rather than an argument. IndicatorCounted reports how many bars were already counted when the indicator last ran, and the reference describes it plainly as a way to optimise the calculation.
The worked example in that reference subtracts one from the returned count before it begins looping, so the most recently counted bar is recalculated on purpose every time. That single line is the clearest statement anywhere that touching the newest bar again is intended behaviour.
Two consequences follow for anyone using a custom indicator on MetaTrader. The first is that the behaviour is a property of the source file, invisible from the chart and unaffected by any input the user can change, which is why it can only be settled by watching the output or by reading the code where a custom indicator is compiled.
What to look for, if the source is available, is short. The loop that fills the indicator buffer has a starting point, and that starting point is either derived from the count the platform supplied or fixed at the whole series. The first form recalculates the newest bars; the second recalculates everything it holds, every time it is called.
A fixed window sits between the two and is legitimate. An indicator that always recomputes the last twenty bars because its own formula reaches back that far is not rewriting history in any meaningful sense, since the values it produces for those bars are the same ones it produced before. Recalculation and change are different events, and only the second is visible to a reader.
The second consequence is that recalculating the newest bar is the documented pattern rather than a defect, so the presence of recalculation proves nothing on its own. What matters is the range of bars a given indicator recalculates, and only the ones behind the live bar are worth an argument. Whether a strategy test reproduced any of this is a separate question, decided by which tick generation mode a test used, which that page covers in full.
A Live Bar Moving Is Not the Complaint
Put the two mechanisms side by side and a common frustration explains itself. An alert fires while the candle is open, the price pulls back, the candle closes elsewhere, and the marker is gone from the chart. Nothing rewrote history. The condition was true at one moment inside an unfinished bar and false when that bar finished.
Both platform accounts above describe this as ordinary. One documents the unconfirmed bar as the reason a realtime calculation can differ from a historical one; the other ships an example that recounts the newest bar on purpose.
The frustration is real even so, because a marker that appears and withdraws is worthless as a trigger unless the rule around it says when to read it. Reading it at the close turns an unstable value into a settled one, at the cost of acting one bar later than the earliest moment the condition was true. That trade is a choice about the rule and not a fault in the indicator. A stop-and-reverse band such as Supertrend makes the choice unusually consequential, because the flip is the whole of the signal rather than one input among several.
Which leaves a single practical test for the thing people actually mean. Look at bars that have already closed, note what the indicator says on them, and come back later to check whether it still says the same. If it does, the indicator is doing what the documentation describes. If it does not, the history on your screen is not a record of what was on your screen.
Non-Repainting Is a Label, Not a Specification
The phrase appears in product listings, in forum recommendations and in file names, and no vendor documentation defines it. There is no published test it refers to, no threshold it clears and no party that certifies it.
The gap matters because the three behaviours are independent. An indicator can refuse to plot anything backwards while still recalculating its newest value on every tick, and a description of it as non-repainting would be defensible under one reading and wrong under another. The word carries information only when it says which behaviour is excluded.
None of that is a judgement about any particular tool, and a tool carrying the label is not thereby suspect. It means the claim cannot be checked from the claim itself. The check has to happen on a chart, in the same way that a description of a tool as leading or lagging is settled by whether it leads price or follows it rather than by the description.
Testing an Indicator on Your Own Chart
The test takes a few minutes and needs nothing beyond the terminal. Pick a timeframe short enough that bars close while you watch, and start with an ordinary chart holding a few days of history.
Record what the indicator prints on the last five closed bars, either in a screenshot or by reading the values into a note. Then force a full recalculation: change the timeframe and change it back, or close the chart and reopen it. Compare the same five bars. Any difference is the dataset or the historical calculation, and it is the answer people are usually looking for.
Watch one live bar separately. Note the moment any signal appears, then wait for the bar to close and see whether the signal survives. A marker that vanishes at the close belongs to the first behaviour in the table and tells you to act on closed bars rather than to discard the indicator.
One result needs separating from the rest before it is counted. An indicator drawn with a declared shift sits a fixed number of bars to the left or the right of the bar it was computed on, and a cloud plotted well ahead of price is the clearest example. That displacement is a stated setting, it never changes once drawn, and it is not the behaviour under discussion here.
The test that separates them is whether the value moves. A shifted plot occupies a bar it was not calculated on, but the number it shows there was fixed at the moment it was produced. A backward plot arrives on an old bar later than that bar closed, which is why the comparison of the same five bars catches one and not the other.
Last, look for values sitting on bars that no signal could have reached at the time, which is the signature of plotting backwards. Extremes marked exactly at a turning point deserve that scrutiny, and so does anything whose construction looks backwards by design, such as a channel drawn from the highs and lows behind it.
Which Reader This Matters To
It matters most to anyone acting on a condition that can turn true partway through a bar, and to anyone who judges a method by scrolling back through its markers, because both take the chart as a record of what was knowable at the time.
It matters least to a reader who acts only on closed bars and never reads history as evidence. For everyone in between, the useful habit is not avoiding indicators that redraw, but knowing which of the three behaviours a given one shows before a decision depends on it.
Risk notice. This page is educational and describes how charting software recalculates indicator values. Nothing here is a recommendation to buy or sell any instrument, no indicator reading is a forecast, and no tool named or unnamed above is endorsed or criticised as a product. Leveraged trading carries a high risk of loss.
