Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

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?

share|improve this question
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. –  jeff m Jun 19 '13 at 0:43
@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. –  ryeguy Jun 19 '13 at 0:52
@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. –  Matt Wolf Jun 19 '13 at 1:32
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. –  Clebson Derivan Jun 19 '13 at 10:12
@ryeguy: If you found my answer helpful you can upvote and accept it :-) Thank you –  vonjd Jun 27 '13 at 14:19
show 2 more comments

5 Answers

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.

share|improve this answer
+1 for mentioning Markov –  Phil H Jan 30 at 8:44
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

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

share|improve this answer
Can you go into more detail? Like how the OP would apply the algorithm to predicting the future based on past results? –  chrisaycock Jun 20 '13 at 12:47
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. –  justaname Jul 7 '13 at 3:43
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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