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?

  • $\begingroup$ Cycles, Elliot Wave principle, etc. In my opinion it's a dumb idea since regimes, the actual market participants, technology, etc. are so vastly different you'll never have the same "window" twice. $\endgroup$
    – jeff m
    Commented Jun 19, 2013 at 0:43
  • $\begingroup$ @jeffm: If I were to implement this, I would probably use relative price rather than absolute price, and I would take the top N matches ordered by some form of distance calculation. $\endgroup$
    – ryeguy
    Commented Jun 19, 2013 at 0:52
  • $\begingroup$ @ryeguy, markets are dynamic and incredibly complex, patterns are all but spurious correlation, most observations you make that already occurred in the past only are repeated by chance not because of some grand design. By the way this site is dedicated to professionals working in this industry and academicians performing research in quant finance space, both of which does not seem to apply here. Just saying you probably find a better venue to pose this particular question than here. $\endgroup$
    – Matt Wolf
    Commented Jun 19, 2013 at 1:32
  • $\begingroup$ I agree with @jeff-m, I tried once, during the tests the results were very positive. however, when I started to send offers at price opportunity identified on the time window, offers were not executed. remaining in the order book until the price took another direction. $\endgroup$ Commented Jun 19, 2013 at 10:12
  • $\begingroup$ @ryeguy: If you found my answer helpful you can upvote and accept it :-) Thank you $\endgroup$
    – vonjd
    Commented Jun 27, 2013 at 14:19

5 Answers 5


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.


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.


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.


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


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

  • 1
    $\begingroup$ Can you go into more detail? Like how the OP would apply the algorithm to predicting the future based on past results? $\endgroup$ Commented Jun 20, 2013 at 12:47
  • 1
    $\begingroup$ I don't get why people are downvoting this, it is actually the correct answer. @chrisaycock, a quick google search of k-nearest neighbors algorithm answers in enough detail for OP or anyone else to understand, it's a very simple approach. $\endgroup$
    – fairidox
    Commented Jul 7, 2013 at 3:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.