Dynamic Time Warping for Stock-Price Pattern Recognition
Summary
This article presents dynamic time warping (DTW) as a way to find price series with shapes similar to a manually selected reference pattern. Unlike point-by-point comparison, DTW can align sequences whose patterns unfold at different speeds or have differences in amplitude. It describes the alignment path as a constrained optimization problem, with boundary, continuity, and monotonicity conditions, solved using dynamic programming. The motivation is to make qualitative chart-pattern matching more systematic across stocks and time periods.
The proposed strategy compares all A-share stocks with the chosen template each trading day, buys at the open when distance falls below a threshold, and generally sells after five days at the close. It exits earlier at the close if a holding day’s loss exceeds 5%. The article reports a backtest Sharpe ratio of 2.59 and annualized return of 27.4%, and says the strategy outperformed a broad market index during the test period. It does not provide enough detail here to assess the sample period, transaction costs, threshold selection, robustness, or out-of-sample performance, so those results do not establish that the pattern generalizes.
Key ideas
- DTW aligns similar price patterns even when their timing or amplitude differs.
- The alignment path is constrained by boundary, continuity, and monotonicity rules and found with dynamic programming.
- The proposed daily strategy buys stocks whose distance to a manually selected template is below a threshold.
- It normally holds positions for five days and exits sooner if a closing loss exceeds 5%.
- The article reports backtest returns but does not detail costs, robustness, or out-of-sample validation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.