Skip to content

The line that was not there at the time

Your chart marks a swing low at ₹412 on 14 March with a neat dot, and your rule says buy the swing low. The dot was not on that chart on 14 March. It appeared four sessions later, at ₹431, and if you truncate the data at 14 March and recompute, it disappears again.

Technical AnalysisAdvanced14 min read
Browse Technical Analysis(123)

The backtest is the best you have built. The rule reads: mark each swing low, buy the next open, exit at the following swing high. Over six years on a basket of midcaps it returns something you would be embarrassed to say out loud, the drawdowns are modest, and the equity curve has the clean upward tilt of a system that has found something. You put it live in April with a small size, and by August it has done nothing at all like the test — not worse in an interesting way, just unrecognisable. Nothing is broken. The signals arrive; they simply arrive at prices you never saw in the test, several days after the bar the test bought on.

The chart is not showing you the past. It is showing you a drawing of the past, made this evening, with everything that has happened since. Most of what is on it could have been computed at the time. A few things could not, and the ones that could not are, with unhappy regularity, the most decisive-looking marks on the screen.

Think of it like this
Naming the peak from the plain

Standing in a range you cannot tell which ridge is the summit — every one of them hides the next. You can only name the highest point once you have walked past it and started descending, and by then you are somewhere else entirely. A map printed afterwards marks the summit with a triangle and gives no hint that the triangle was unavailable to anybody standing on it.

In the market

A swing high is a peak named from the plain. It is only a swing high once enough subsequent bars have failed to exceed it, which means the mark on your chart is always dated earlier than the moment it could first be made. Your eye reads the triangle as information that was on the mountain.

The four ways history gets redrawn

[[Repainting]] is the general name for an indicator or marker whose historical values change as later data arrives. The word gets used as an accusation, which is unhelpful — some of these are perfectly legitimate constructions being read wrongly, and only one of them is a defect. It is worth separating them, because the remedy differs.

KindWhat it isIs it a problem?
The unfinished barThe current candle’s close, colour and both wicks are still moving. Every indicator computed on it is provisionalNo — it is honest, and this track covers it separately. It becomes a problem only when a signal is acted on before the bar closes and then recorded as though it had closed there
Confirmed after the factSwing points, fractals, zigzag legs and the pivot labels built on them. A point is only marked once a set number of later bars has failed to exceed itNot a defect in the indicator, and a serious one in a backtest. The marker is dated to a bar it could not have been placed on. This is the category that ruins strategies
Deliberately displacedIchimoku plots two lines forward and one line back. The forward ones were computed from data you already had, so they are known in advance. The backward one places today’s close at a location weeks earlierNo, if read correctly. The forward lines are causal. The line drawn backwards is today’s information sitting on an old date, and comparing it with the price there is a comparison across time, not a signal that existed then
Restated inputsA bonus issue or a split arrives, and the vendor restates the entire price history so it is comparable. Every price before the event changes, so every indicator value computed over that history changes with itNecessary and correct, and the one nobody calls repainting. Your chart of last month and your chart of that same stretch today are different charts, and any level you noted down in rupees is now in the wrong units
Only the second row is a trap in the ordinary sense. The other three are correct constructions that mislead when read as though the whole chart were available at every point along it.

Why the confirmed-after-the-fact kind is so costly

A [[Swing high]] has to be defined by something, and the usual definition is a bar whose high exceeds the highs of some number of bars either side of it. The bars on the left are available when the bar prints. The bars on the right are not. A [[Fractal]] marker in the common formulation needs two subsequent bars with lower highs, so it appears two bars late, always, by construction. A zigzag leg needs a reversal of a set percentage before it will fix the pivot, so on a quiet stock the pivot may be fixed a fortnight after the bar it is drawn on — and until it is fixed, the last leg on the chart can be erased and redrawn somewhere else.

Worked example
What the backtest bought, and what you could have bought
Illustrative — a midcap, three-bar swing definition, exit at the next marked swing high
The mark on the chartA neat dot under the bar, indistinguishable in appearance from any other mark on the chartSwing low, 14 March, ₹412
When it could first be placedThree subsequent bars had to print higher lows before the definition was satisfied. On 14 March, and on the 15th, 16th and 17th, that bar carried no dot at all19 March
What the backtest recorded as the entry“Buy the open after the swing low.” Perfectly reasonable code, reading a column that was populated after the fact₹415, the open of 15 March
What you could actually have paidThe earliest open following the earliest moment the signal existed₹431, the open of 20 March
The gap on one tradeAgainst an average winning trade of, say, 6 per cent, most of the edge has gone in the entry alone₹16 a share, or 3.9 per cent
And the exit has the same defectSo the trade is entered later and exited later, and the two errors do not cancel — a system built on marked pivots is being tested at prices that were unavailable at both endsThe exit swing high is confirmed late too
What the live results looked likeNothing malfunctioned. The live system was doing the only thing it could, and the test had been doing something elseSignals arriving days late, at worse prices, for four months
The whole error is contained in one sentence: the column the backtest read was not populated at the timestamp it was indexed by. That is [[Look-ahead bias]] in its purest and least visible form, because there is no future price anywhere in the code — the code only reads a marker, and the marker is the thing that knows the future. Nothing about this shows up as a bug, a warning or an anomaly in the equity curve, which is why it survives review so easily and why it needs a mechanical test rather than a careful read.

The two that mislead without being wrong

  • The displaced line. Ichimoku’s [[Chikou span]] plots the current close at a location well to the left of the current bar. Read as intended, it is a comparison — today’s close against the price some weeks ago — and it is a legitimate one. Read carelessly, it looks like a line that was above the price back then, and a rule written as “the lagging line was above price on that date” is a rule about information that arrived weeks after that date. The cloud plotted forward is the opposite case and causes no trouble: its values were computed from data you already had, which is precisely why they can be drawn ahead of the bar.
  • The restated series. After a bonus or a split, an [[Adjusted price]] history restates everything before the event. This is correct and you want it — the alternative is a cliff in the series that generates a spectacular false signal — but two consequences follow. Every indicator value over that history has changed, so a chart you studied last month is not the chart you will open today. And every level you wrote down in rupees is now expressed in a different unit; a support at ₹1,240 noted before a 1:1 bonus is a support at ₹620 on the chart you are looking at, and your alert is still set at ₹1,240.
  • Derived bar types inherit all of it. A [[Heikin-Ashi]] candle is computed from the previous Heikin-Ashi candle, so the whole series is path-dependent on where the platform started the calculation; two platforms with different history lengths produce slightly different Heikin-Ashi charts of the same stock. Whether a Renko chart’s newest brick can appear and then vanish depends on whether the platform builds bricks from closes or from intraday extremes. Neither is a defect. Both mean the historical chart and the live chart are not the same object.
Check yourself

Your chart marks a swing low at ₹412 on 14 March, using a definition requiring three subsequent bars with higher lows. Your backtest buys the next open, ₹415 on 15 March. What is wrong with that, and how would you establish it?

Simple bhasha mein
Match ke baad wala "turning point"

Match khatam hone ke baad commentator batata hai ki 34th over hi turning point tha, aur baat bilkul sahi hoti hai. Par 34th over ke waqt stadium mein kisi ko yeh pata nahi tha — pata tab chala jab match khatam ho gaya. Chart pe swing low ka nishaan bhi aisa hi commentator hai. Aapke rule ke hisaab se swing low tabhi maana jaata hai jab uske baad teen bar aur bane jinka low usse ooncha ho. 14 March waale bar pe ₹412 ka dot lagta hai — par woh dot 14 ko chart pe tha hi nahi, 15, 16, 17 ko bhi nahi. Woh 19 March ko aaya, jab teesra confirming bar bana. Backtest ne kharida 15 March ka open, ₹415. Aap se jaldi se jaldi 20 March ka open milta, ₹431 — ₹16, yaani 3.9% ka farq, sirf entry mein, aur jeetne wale trade ka average agar 6% hai toh edge ka zyada hissa yahin chala gaya. Exit bhi usi tarah der se confirm hota hai, toh dono taraf se ragda. Test ek hi hai aur pakka hai: data ko signal waale bar pe kaat do aur dobara compute karo. Nishaan ab bhi hai toh woh us din maujood tha; gayab ho gaya toh aap us par trade kar hi nahi sakte the.

What to remember
  • A chart is drawn this evening from all data to date; it is not a photograph of what was on the screen then.
  • Swing points, fractals and zigzag legs are confirmed only after later bars print, so the mark is always dated before it could exist.
  • Ichimoku’s forward-plotted lines are causal; the line plotted backwards places today’s close on an old date.
  • A corporate action restates the whole adjusted history, changing every past indicator value and every level you wrote in rupees.
  • Truncate the series at the signal bar and recompute — if the signal moves or vanishes, it was never available.
Finished this lesson?

Mark it done to track your progress through the curriculum.