Suppose a historical analogue turns up for the current stretch of chart with a high similarity score. The overall shape repeats, the curves lie on top of each other — and the last few candles run the opposite way: the sample ends upward, the matched window ends downward.
Formally nothing is wrong: the similarity really is high. In substance the match is harmful, and the reason lies not in any particular algorithm but in the idea of a single similarity number.
Why it happens
Any similarity measure folds a comparison of two curves into one number, and it does so by averaging: disagreements are summed along the whole length and divided by it. Every candle contributes equally.
Hence some simple arithmetic. If the sample is fifty candles and the last ten disagree, that disagreement is a fifth of the sum, averaged with forty candles where everything matches. Even a completely inverted ending costs a candidate a handful of points out of a hundred.
This is a property of averaging rather than of a particular formula. Correlation, alignment algorithms such as DTW and step-by-step comparison all share it: each describes the curve as a whole, and none of them knows which part of it matters more to you.
Similar shape
- A
- B
- Last segment: 6–8
- Inspect the last segment separately from the overall match.
Why it hurts here in particular
The parts of a curve are not equally valuable — not to the algorithm, but to the reader.
You look for an analogue to understand the current situation. The current situation is the end of the window: the last candles, and where price was heading at the moment you are looking at the chart. The middle describes a prologue that has already happened and has no bearing on the decision.
So there is a mismatch: the algorithm weighs the whole length equally, while the value of the parts to the reader sits almost entirely in the tail.
Why raising the threshold does not save you
The tempting fix is to demand higher similarity. It does not work.
A threshold is a requirement on the average over the whole length. Raising it demands a better match overall, not a better match at the end. A candidate with a perfect middle and an inverted tail will comfortably outscore one with a slightly noisier middle and a correct tail — simply because the noise in the middle spans more candles.
Comparing totals does not save you either: two windows can arrive at the same net change by completely different routes. Matching totals say nothing about how price got there, still less about the final candles.
Last segment · A
- Rise
Last segment · B
- Fall
- Similarity measures shape, not the future.
What to do about it
Look at the ending separately, not only at the number. In practice that means three things.
Open the matches themselves, not just the list. Three or four charts actually looked at tell you more about the sample than the summary figure.
Compare the tails by eye. The sample's last candles against the match's last candles — do they run the same way. It takes seconds and removes most of the harmful analogues.
Treat the similarity number as a description of the whole. It honestly answers "how alike are these curves on average" and does not answer "is the part I care about alike".
A common mistake
Concluding that high similarity with an inverted tail signals an imminent reversal: "it looked just like this before, and then it went down." It does not. A match with an opposite ending means exactly one thing: the chosen measure judged the curves similar, while the part you cared about was one it barely weighed.
Nothing about a reversal or a continuation follows from it.
In Scan Chart, divergence between the endings is taken into account when matches are selected. That does not retire the habit of checking the tail by eye: it is worth keeping with any tool that compares shapes.