Skip to content
All library documents

Historical Pattern Matching for Price Forecasts and Its Limits

Article Quant Q&A · Author: ryeguy

Summary

The document surveys ways to search historical price data for segments resembling a recent market path, then use what followed those matches to inform a forecast. Suggested approaches include nearest neighbors, clustering, seasonal pattern analysis, and dynamic time warping, which can compare shapes that unfold at different speeds. It also points to statistical evaluation of time-series patterns and a variable-order Markov tree study as examples of research on recurrence and predictability.

The cited study reports that detected predictability varied across markets and periods; its summary says the more volatile markets in its sample were efficient at a high confidence threshold. These findings do not establish a tradable strategy or generalize to other data. The answers emphasize that choosing a useful distance measure is difficult and that price-pattern prediction alone carries substantial risks. Any implementation would need careful statistical testing to distinguish real predictive value from chance and overfitting.

Key ideas

  • Historical analog forecasting finds past price paths similar to the current window and examines their subsequent moves.
  • Dynamic time warping can compare patterns that differ in duration or timing.
  • Nearest neighbors, clustering, seasonal analysis, and Markov models are related approaches.
  • Research cited in the discussion finds that predictability can vary across markets and periods.
  • Pattern similarity alone does not demonstrate a robust, tradable edge.

Tags

Full text
# Answer by vonjd (score 6)


# Is there a name for, or any research on, a system where you try to predict future price by finding a similar price history in the past?












Allow me to explain.

You look back from some period to the present. Say a week ago to now, using a per-minute view. You then crawl through your database of past price data, and you try to find a history segment that is most similar to what that one week window is. You display the historical data's price after that matched historical segment in hopes that the current market will follow a trend similar to what that historical data did.

To me, this sounds like a great strategy because it attacks the market on the pattern level. It doesn't rely on indicators to look for trends, it looks for the trends themselves. But I can't help but think that this is naive and will be a waste of time to implement.

Has anyone done this? Or can anyone tell me why this is a dumb idea?

## Answer by vonjd (score 6)

https://quant.stackexchange.com/a/8258

You might want to check out the book Evidence Based Technical Analysis by David Aronson.

In it he applies statistical techniques to determine whether certain time series patterns have any predictive power. It's an interesting read and should equip you with some ideas on how to differentiate between folklore and statistical rigor. It also gives you ample literature references.

You can find a good overview and summary of the book on CXO Advisory.

You can also find further material on the webpage of the author.

## Answer by afekz (score 4)

https://quant.stackexchange.com/a/8372

Some reading that may be of interest to you and which proceeds along similar lines of thought is that of Shmilovici in "Predicting Stock Returns Using a Variable Order Markov Tree Model".

Abstract: "The weak form of the Efficient Market Hypothesis (EMH) states that the current market price fully reflects the information of past prices and rules out predictions based on price data alone. In an efficient market, consistent prediction of the next outcome of a financial time series is problematic because there are no reoccurring patterns that can be used for a reliable prediction. This research offers an alternative test of the weak form of the EMH. It uses a universal prediction algorithm based on the Variable Order Markov tree model to identify re-occurring patterns in the data, constructs explanatory models, and predicts the next time-series outcome. Based on these predictions, it rejects the EMH for certain stock markets while accepting it for other markets. The weak form of the EMH is tested for four international stock exchanges: the German DAX index; the American Dow-Jones30 index; the Austrian ATX index and the Danish KFX index. The universal prediction algorithm is used with sliding windows of 50, 75, and 100 consecutive daily returns for periods of up to 12 trading years. Statistically significant predictions are detected for 17% to 81% of the ATX, KFX and DJ30 stock series for about 3% to 30% of the trading days. A summary prediction analysis indicates that for a confidence level of 99% the more volatile German (DAX) and American (DJ30) markets are indeed efficient. The algorithm detects periods of potential market inefficiency in the ATX and KFX markets that may be exploited for obtaining excess returns."

It's not something I've ever tried to implement but is still living on my shelf along with plenty of other material waiting for some proper attention in due course.

## Answer by HungryFoolish (score 3)

https://quant.stackexchange.com/a/10725

I know this is a really old question but here is something I ran into while trying to do essentially the same thing. One of the problems that you face when trying to detect patterns using (say) k means clustering is how do you encapsulate a pattern. For example, suppose on a certain day the index goes up 2% over a minute and then goes down 1% over the next 10 minutes and then on some other day, the index goes up 2% in 3 minutes and then goes down 1% over the next 15 minutes.

How do you enforce that these two cases are close together using your chosen distance measure? An approach that worked pretty well for me was using dynamic time warping to rank my history of cases versus the current pattern that I see in the market. This method is resistant to squeezing together or dilation of patterns in time(or number of trades if you so wish).

Have a look at DTW example here. I believe it is close to what you have in mind. However I would like to add the disclaimer that using purely price patterns for prediction is a path fraught with many dangers.

## Answer by cloudviz (score 2)

https://quant.stackexchange.com/a/10728

I believe what you are looking for is called Seasonal pattern. Here is a good source - http://signalfinancialgroup.com/Seasonal/SeasonalOverview.php

## Answer by wh0 (score 0)

https://quant.stackexchange.com/a/8276

I think the thing that best fit your idea is k-nearest neighbors algorithm.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.