Skip to main content
Track Pattern recognition
10 / 25
Library

1998issue C011-4

Sliding-window correlation for cup-and-handle construction

A cup-and-handle can be stored as a shorter equal-interval series and scored on every same-length window of a longer tape. The ordinary linear-association coefficient is a scale-free-fit, so a historical clip and a smoothed prototypical-pattern can be read on the same sliding-window-scan.

  • A chart shape can be stored as a shorter equal-interval series and scored on every same-length window instead of being accepted or rejected by a simple up-day and down-day rule.
  • The ordinary linear-association coefficient is a scale-free-fit: 1 marks an identical orientation, -1 marks an inverted-match, and values near 0 mark no resemblance.
  • Scores of 0.8 or higher were treated as matches a person can recognize by eye, and a smoothed prototypical-pattern produced a similar score path to a raw historical clip.
  • Template-length must be fixed in advance to within a few sampling intervals, or the score falls quickly and several lengths of the same shape are required.
Entries in this reading3 entries

Store a shape, then score every window

A chart shape can be stored as another equal-interval series shorter than the series under review. That stored series is then scored on every same-length window. The figure is not accepted or rejected by a simple up-day and down-day rule.

How the sliding-window-scan is scored

A sliding-window-scan compares a fixed-length template with every same-length stretch of a longer, evenly spaced price series and plots the fit against time. The scan uses the ordinary linear-association coefficient from least-squares curve fitting. A value of 1 marks an identical orientation. A value of -1 marks an inverted-match, a window whose shape is the template turned upside down. Values near 0 mark no resemblance.

For two length-N series the coefficient is their covariance divided by the product of their standard deviations. A spreadsheet can compute it on a 21-point template against each successive 21-point window, aligning each value to the window center.

A scale-free-fit

Because the coefficient is normalized, only the shapes of the template and the window change the score. The numeric scale of either series does not. That scale-free-fit depends on relative shape, not on the absolute levels of the template or the market window. Scores of 0.8 or higher were treated as matches a person can recognize by eye.

A historical excerpt and a prototypical-pattern

A 21-session cup-with-handle excerpt scanned across a 264-session daily-close series produced five windows above 0.8, including a perfect 1.0 at the excerpt's own location. A smooth fourth-degree polynomial plus a four-session handle produced a similar score path. A prototypical-pattern can therefore stand in for a raw historical clip, so one library shape can be reused across many series.

Lock the template-length

Template-length is the sampling-interval count of the pattern series. It must be chosen before the scan and kept nearly constant from window to window. If it is not fixed in advance to within a few sampling intervals, the score falls quickly and several lengths of the same shape are required.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
10 of 25 in the Pattern recognition track
20001-5 pp.Next on Pattern recognitionConstructing rectangles for breakout hypothesesA rectangle is two roughly parallel horizontals around a bounded range. It can finish as a reversal-formation or a continuation-formation, and the prints inside the box do not show breakout direction.
All readings on this track · 25 readings
  1. 1986Construct a decision procedure that revises itself
  2. 1989Finish the volume checklist before scoring the breakout
  3. 1989Constructing supervised forecasts on moving averages
  4. 1991Candlestick labels as stacked construction tests
  5. 1992Walk-forward evaluation of weekly price-change patterns
  6. 1993RSI price pattern templates and open interest
  7. 1994Constructing a dual-net day-ahead index direction forecast
  8. 1994A clocked stochastic second crest with a window-high stop
  9. 1996Volatility-ratio, inside-day and narrow-range-4 entry construction
  10. 1998Sliding-window correlation for cup-and-handle construction
  11. 2000Constructing rectangles for breakout hypotheses
  12. 2001Turning one candle into a ranked numeric object
  13. 2002Fuzzy-scored chart patterns as testable rules
  14. 2002From hot-zones to an open-close-matrix
  15. 2003Volume pressure and a band-clearing breakout case
  16. 2004Evaluating chart patterns against price objectives
  17. 2004Cobweb turning points from price structure
  18. 2005Hybrid decision trees and pattern recognition for trend rules
  19. 2005Two-bar zone codes for testable pattern systems
  20. 2005Price bar pattern construction and next-bar frequency
  21. 2008Observe markets before following pattern or system rules
  22. 2012Treat a four-leg Fibonacci completion as an unpaid hypothesis
  23. 2014Hidden three-channel regression signals for stock and call option entries
  24. 2014A shared daily-chart-level framework for session trades and swing holds
  25. 2015Condensed candlestick signatures
All 48 readings tagged Pattern recognition
Also on Pattern recognition5 readings