How Chart Library Works

Chart patterns repeat. But they don't repeat in a vacuum.

A bull flag in a calm bull market is a different event than the same bull flag forming during a credit spread blowout. Chart Library matches patterns by both shape and market regime.

Loading market context...

The Problem With Shape-Only Matching

For six months we matched charts by shape alone. Type a ticker, get 10 similar-looking historical charts, see what happened next. It was useful — but it missed something obvious.

Imagine NVDA consolidating at its 200-day MA. A pure shape match might pull up a consolidation from February 2020 (right before COVID), November 2021 (top of the bubble), and October 2022 (bear market bottom). Same shape, wildly different market conditions, wildly different outcomes.

Reality check: On our own 16,000+ forward tests, shape-only pattern matching gives approximately coin-flip direction accuracy. Chart shapes alone are not an edge. The regime is what conditions the outcome.

The 12-Dimension Context Vector

Every pattern in our database has a 12-dim context vector attached to it, capturing the market regime when the pattern formed. The features are research-backed, not made up:

VIX Level
Fear regime — percentile rank over 252 days
VIX Term Structure
Contango vs backwardation (fear acceleration)
Variance Risk Premium
Implied minus realized vol — the fear tax
Yield Curve
10y minus 2y Treasury spread
Credit Spreads
High-yield OAS — financial stress
Market Breadth
% of stocks above 50-day MA
SPY Trend
20-day return z-score
Trailing Volatility
Stock-specific realized vol percentile
Volume Ratio
Today vs 20-day avg — participation regime
SPY Correlation
Rolling 20-day beta state
Earnings Distance
Days to nearest earnings announcement
Market Cap Bucket
Mega / Large / Mid / Small / Micro

Research citations: Bollerslev, Tauchen & Zhou (2009) on variance risk premium. Daniel & Moskowitz (2016) on momentum crashes in panic regimes. Gilchrist & Zakrajsek (2012) on credit spreads as macro predictors. The VIX term structure work is Johnson (2017). Our feature weights lean on their effect sizes.

Two-Stage Search

  1. 1
    Shape similarity (L2 distance on 384-dim embedding)

    Every chart is compressed into a 384-dimensional vector capturing its shape. We use pgvector to find the 50 closest historical patterns by Euclidean distance in under 10ms.

  2. 2
    Context re-ranking (weighted distance on 12-dim regime vector)

    Of those 50 shape-similar patterns, we re-rank to surface the 10 that also occurred in the most similar market regime. The final list is what you see — matches by shape AND conditions.

What You See On The Website

  • Regime badge in the navbar — always shows today's regime label (Bull+Calm, Bear+Volatile, etc.) with SPY/QQQ change and realized vol.
  • Context fingerprint on every match — a 12-cell colored strip showing per-dimension similarity between your query and that match. Green = similar regime, red = different regime.
  • Regime filter toggle — on any search, switch to "Regime-matched only" and the forward return stats recalculate using only matches from similar conditions.
  • Market Dashboard — a full view of current regime indicators (VIX, sectors, breadth, crowding) at /regime.
  • Accuracy by regime — our track record broken down by market conditions at /track-record. Honest reporting — some regimes we're more accurate than others.

For Developers

The context_weight parameter on our /api/v1/analyze endpoint controls the re-ranking blend:

  • context_weight=0 — shape-only (default, backward compatible)
  • context_weight=0.05 — recommended, shape dominates with regime adjustment
  • context_weight=0.20 — strongly context-weighted, useful for regime-sensitive strategies
  • context_weight=1.0 — context dominates (experimental)

Honest Caveats

Context-aware matching improves pattern relevance. That's well-supported — our own validation shows 4-17 percentage-point spreads in win rates across different VIX/volatility regimes for our 16K+ forward tests.

Whether context improves profitability of a trading strategy is a separate question, and we'll publish the retrospective A/B comparing shape-only vs context-weighted results once our full backfill completes and we have enough out-of-sample data.

All outputs are historical facts — what happened in the past after similar setups. Past patterns do not guarantee future results. This is not financial advice. See our disclaimer.

Try context-aware matching on any ticker

Search a chart →