Education8 min read

DTW vs Pearson: Which Algorithm Finds Better Bitcoin Patterns?

DTW vs Pearson: how each measures Bitcoin price similarity, when each algorithm wins, and why the Ensemble combination often outperforms both.

When you run historical pattern matching on Bitcoin, the algorithm you choose fundamentally changes which historical instances you retrieve — and therefore what prediction you get. DTW (Dynamic Time Warping) and Pearson correlation are the two most widely used algorithms for financial time series similarity, and they measure similarity in genuinely different ways. Understanding the difference changes how you use the Pattern Finder and how much confidence to assign to any given result.

How Dynamic Time Warping (DTW) Works for Bitcoin

DTW measures the similarity between two price sequences by finding the optimal alignment between them — allowing one sequence to be "stretched" or "compressed" in time to best match the other.

Imagine a Bitcoin bull flag that took 30 candles to form in the current setup. DTW can match it against a historical bull flag that took 45 candles, by aligning the structural features (the entry to the flag, the consolidation, the tightening near the apex) rather than requiring that candle 15 in one sequence correspond to candle 15 in the other.

The practical result: DTW finds historical instances that look similar in shape even when the timing of individual moves was different. This is extremely useful for Bitcoin because:

  • The same patterns take different amounts of time to form across different market regimes
  • Bitcoin consolidations in low-volatility periods compress into fewer candles than in high-volatility ones
  • The rate of price movement varies significantly between bull and bear market conditions

How Pearson Correlation Works for Bitcoin

Pearson correlation measures the linear relationship between two sequences with exact temporal alignment — candle 1 must correspond to candle 1, candle 10 to candle 10. It asks: do these two sequences move in the same direction, at the same relative time, consistently throughout?

A Pearson score of +1.0 means the two sequences are perfectly correlated — every up-candle corresponds to an up-candle, every down-candle to a down-candle, at exactly the same times. A score of -1.0 means they are perfectly inversely correlated. A score near 0 means no meaningful linear relationship.

Because Pearson requires exact temporal alignment, it is more restrictive than DTW. It will miss historical instances where the pattern took a different number of candles to form but is otherwise highly similar. However, when it does find high-Pearson matches, the directional timing is highly precise — the matches lined up almost exactly.

When DTW Wins Over Pearson

DTW is the superior algorithm when:

  • The current Bitcoin pattern might have formed in different timeframes in historical occurrences
  • You want the broadest possible set of similar patterns and are willing to trade some timing precision for more matches
  • The market regime (volatility, trend speed) has changed between the current period and historical periods you want to match against
  • You are analyzing longer-term patterns (daily, weekly) where temporal alignment is inherently less precise

When Pearson Wins Over DTW

Pearson is the superior algorithm when:

  • The timing of specific candles within the pattern matters — for example, you want to find historical instances where a specific day of the week or a specific event-driven candle aligns exactly
  • You are analyzing shorter-term patterns (5m, 15m) where the temporal compression/stretching that DTW allows would reduce relevance
  • You specifically want high-precision matches with the same exact sequence of ups and downs, not just the same overall shape

When Ensemble Beats Both

The Ensemble algorithm in the Pattern Finder combines multiple similarity measures — including shape distance, directional alignment, and temporal correlation — into a single weighted composite score. This means it does not optimize for any single dimension of similarity but produces matches that are broadly similar across multiple dimensions simultaneously.

Ensemble beats both DTW and Pearson individually when:

  • You do not know in advance which dimension of similarity (shape, timing, direction) is most important for the current setup
  • You want the most generally "similar" historical instances rather than the best matches on one specific measure
  • You are starting a new analysis and want to explore the historical landscape before committing to a specific algorithm

The practical Bitcoin workflow: start with Ensemble to get a broad view, then switch to DTW if you want more shape-based matches with temporal flexibility, then validate with OBV matching to confirm that the volume flow also resembled the current period in the historical matches. Agreement across all three gives the strongest signal.

OBV Matching: The Underutilized Tool for Bitcoin

Bitcoin is particularly well-suited to OBV-based matching because institutional volume flows are a primary driver of BTC price — and they leave distinctive fingerprints in OBV data. When institutional buyers are accumulating, OBV rises even as price consolidates. When they are distributing, OBV falls even as price stays elevated.

Running OBV-based pattern matching alongside price-based matching provides a two-dimensional confirmation: the price shape and the volume flow both resemble the historical instances. This combined signal has historically preceded the strongest directional moves.

Frequently Asked Questions

What is Dynamic Time Warping (DTW) for Bitcoin analysis?

Dynamic Time Warping (DTW) is a time series similarity algorithm that allows elastic time alignment — matching price sequences that have the same overall shape but took different numbers of candles to form. For Bitcoin analysis, DTW is valuable because the same chart patterns (bull flags, wedges, triangles) take different amounts of time to form across different market regimes. DTW finds the historical instances that most closely resemble the current pattern's shape, even if the historical instance was faster or slower than the current formation.

What is Pearson correlation for pattern matching?

Pearson correlation measures the linear relationship between two price sequences with exact temporal alignment — candle 1 must correspond to candle 1, candle 10 to candle 10. It produces a correlation coefficient between -1 and +1, where values near +1 indicate that the two sequences moved in the same direction at the same time consistently. Pearson is more restrictive than DTW (it requires exact timing) but produces higher-precision matches when it does find similarity — the directional timing is highly accurate.

Which is better for Bitcoin patterns: DTW or Pearson?

Neither algorithm is universally better — they answer different questions. DTW is better when you want broad shape-based matching with temporal flexibility (the same pattern that took different numbers of candles to form historically). Pearson is better when the exact timing of moves matters and you want the highest-precision temporal alignment. For most Bitcoin pattern analysis, DTW finds more useful matches because Bitcoin's patterns take variable amounts of time to form across different market conditions. Use both and compare the results — agreement between DTW and Pearson top matches is a strong confirmation signal.

What is the Ensemble algorithm in LetsDoCrypto?

The Ensemble algorithm in LetsDoCrypto's Pattern Finder combines multiple similarity measures — including shape distance, directional alignment, and temporal correlation — into a single weighted composite score. Instead of optimizing for one dimension of similarity, Ensemble produces matches that are broadly similar across multiple dimensions simultaneously. It is the recommended starting algorithm for most Bitcoin pattern searches because it avoids the blind spots of any individual algorithm and provides the most balanced overall view of historical similarity.

When should I use OBV pattern matching instead of DTW?

Use OBV pattern matching as a confirmation tool alongside DTW or Ensemble, not as a replacement. OBV matching finds historical periods where the volume flow pattern — how cumulative volume was building or declining — most closely resembles the current OBV shape. This is particularly valuable for Bitcoin because institutional accumulation creates distinctive OBV signatures (rising OBV while price consolidates). When OBV matches show the same subsequent price behavior as price-based matches, the convergent signal has significantly higher reliability.

DTW AlgorithmPattern MatchingTechnical AnalysisBitcoin Chart PatternsEnsemble Method

Try it yourself

Everything described in this article is available free on LetsDoCrypto — no sign-up required.