Oversimplified Method for Finding Patterns in Stock Charts
Before we begin to determine the predictive capabilities of patterns in stock charts, we probably should come up with a method to identify patterns. To do this we are going to come up with a really simple method to start exploring the nature of pattern recognition. Just as the Naïve Bayes algorithm ignores certain assumptions made by the Bayes Theorem, we are going to work towards a practical way to pull patterns from streams of data.
To be honest, I have not worked with chart patterns in any detail before this week. Looking into the study of chart patterns has always been on my To Do list. I have been interested in Sequence Patterns – not dissimilar with chart patterns – but more one the discovery of new patterns, rather than detecting patterns that are well known – like the Head and Shoulders pattern. Over the years I have heard people mention Head and Shoulders and although the pattern’s name is pretty descriptive, I was not 100% certain what it looked like. After some browsing on the web and looking at real and prototypical examples, I came up with this simple graphic that gives us a template of the classic Head and Shoulders pattern.

In fact, this is the actual template that we are going to use. Notice that we are looking at 7 price points. The first three points form the left “shoulder”. There is a peak in the center above the two “shoulders” – this is the “head” of the pattern. Finally, the last couple of points give us the right “shoulder”. Again – remember that I am not a Chartist – an expert in chart patterns or even a believer in chart patterns. That is – until I get some interesting evidence that the patterns are meaningful.
We have our prototype Head and Shoulders pattern that we can use as a template, overlay the template on a stock chart and decide if the pattern is present in that chart or not. Being that we are very lazy and have technology at ready hand, we decide to come up with an automated routine for finding the Head and Shoulders pattern in our stock data. Luckily, we have been using a simple measure for finding stocks that move together – correlation.
Correlation is simple, fast to calculate and we will see how good it is at finding patterns in data. Basically, we are taking the seven numbers that were used to create the template graphic and then doing a correlation with the closing price over the last seven trading days. So, we are able to find patterns like this:


Our template is below for comparisonon. The graphic above is AMNT closing prices over a 15 day period and we have a seven day Head and Shoulder pattern highlighted in red. That is pretty distinctive, so that seems to work pretty well. Hmmmmm… Are all Head and Shoulder patterns 7 days long? I don’t think so.
So, we need to come up with a way to stretch the pattern out and compare across longer time dimensions. I came up with a morphing routine that stretches the pattern to twice its size, three times, four times on up to a time frame of about 100 days in length. Although the routine is kind of crude, it does give us a way to automatically find perspective Head and Shoulder patterns that are up to one hundred days in length. At this point, the artistic part of chart analysis comes into play. We have the routine run every morning on the previous day’s closing prices and present the stocks which seem to show the Head and Shoulders pattern. Take a look at the Head and Shoulders pattern experiment page and see what you think.

[...] Last week we put together a really simple way to identify Head and Shoulders patterns in stock charts and we have a daily list of stocks with potential Head and Shoulders - BUT, these are experimental of course. This where the human interacts with the technology. We have an algorithm that searchs for potential patterns, then it is left to the human to determine if it really is a Head and Shoulders formation. And what does it mean if it is a correct formation in the eyes of the human? That is left to the human to decide. [...]
[...] It has been pointed out that in the article Oversimplified Method for Finding Patterns in Stock Charts the actual method used was not described in detail. The process is pretty simple - you might even say oversimplified. It was just an error of omission, not an attempt to hide any proprietary methods. In fact, just as a gentle reminder - this blog is for the open discussion and exploration of advanced techniques for analyzing the stock market. [...]
[...] I agree with the 1st point; however, if you take a look at the origins of this technique -> Oversimplified Method for Finding Patterns in Stock Charts - you can see that it is a really simple and brittle example of how to find patterns - thus Oversimplified. I did go back and make some adjustments and patterns for today have been tweaked based on the first suggestion. [...]
[...] Here’s a couple interesting lists that Eric over at DeepMarket is adding using the StockTickr Email API. The top 10 Head and Shoulders Patterns (RSS) and Inverted Head and Shoulders Patterns (RSS) are being added at the end of each trading day. I asked Eric to explain a little about how his process works: As an experiment I am trying simple correlation to help bring up a list of “possible” head and shoulders patterns. I describe it in more detail in my articles Oversimplified Method for Finding Patterns in Stock Charts and Correlation Pattern Matching Explained. The process is very simple and the results are mediocre at best - I get a lot of nasty email from technicians - but very little insight about how they find them. I standard case of “I know it when I see it” syndrome. What I was trying to do is show how programs can help humans reduce their work load (looking for patterns), but generally it is still up to the humans to determine if the patterns are valid or not. [...]