Saturday, February 18, 2012

On Technical Analysis

Support, resistance, pivot points, head and shoulders, double top, pennant, flags... the list goes on. We've all heard of them and chances are at some point we have either tried using them or wondered how in the heck it could possibly work. And yet, thousands (I've done no research in claiming that number although I highly doubt I'd be that wrong) of investors and traders all around the world use it as a tool in one way or another in guiding their strategies. We will examine if there's any merit to technical analysis.

It is well documented in social sciences research that humans tend to see patterns where none exist (click Kahneman). It also leads to confirmation bias which I will talk about briefly later. There have been so many books and seminars on technical analysis that it is without a doubt used quite fervently. While we will not cover all the various technical indicators, we will focus on one which is quite simple to use- the support and resistance.

Without going into too much detail, support and resistance basically involves drawing a line across a chart along points off of which prices tend to bounce. In case of prices bouncing off higher, the line is called a support and in cases when they bounce below, it is called a resistance. The same line can be a support or resistance which should be clear from the chart below.

SPY chart with SnR line drawn at $128

If one were to believe the idea behind support and resistance, one would have to build a strong testing scenario where any support or resistance possibility had arisen and whether or not the market actually followed it. A significant result would be a 90% plus probability that any time prices bounce off of a specific price level and it encountered that level again, a support or resistance level could thus be established. The problem, however, lies with the fact that markets are not smooth- there's numerous times a day (or month or even a year- depending on which time frame you're using) when prices bounce up or down from a given level. It's what markets do!

And how does one know if the phenomena is just randomness in the market? Prices could behave in such a way that patterns could seem like the result of market forces. Could one test for that? I decided to- using a handy tool called Matlab and I'll be using it quite frequently in future posts. This is what I did- I wrote a script in Matlab to generate pseudo random numbers between -0.02 and +0.02 and used them as daily returns for a stock price. The reasons I chose -0.02 and 0.02 are because it'll help clarify the test (using large swings would only make things better- I wanted to be as far off as possible from real market conditions). And then, using a prebuilt Matlab function that plots high, low, open and close candlestick charts for a specific interval (creatively called "candle"), I plotted the results.

Here's an output from that program:

Support and Resistance phenomena on a randomly generated chart 
I've highlighted in yellow the SnR region.

If it surprises you, don't be. This is perfectly normal of random processes. Toss a coin a million times and chances are you could get a string of heads (or tails) for over a hundred times in a row. Does that mean the coin is biased? No!

Similarly, one could argue that just because stock prices seem to exhibit this behaviour of SnR doesn't mean that it can actually be used as a profitable strategy. This is where confirmation biases comes in. Just because we've seen SnR phenomena in the past and we acted on it and were profitable, doesn't mean it'll happen again. The resistance can be "broken" and one could incur a large loss on the downside.

However, let's not be too hard on SnR. Andrew Lo, a professor of finance at MIT argues that one needs to study these more rigorously. The paper can be found here: http://web.mit.edu/alo/www/Papers/1705-1765.pdf

It is quite a long read so read it when you have some spare time. It might also be difficult to read if you're afraid of equations. The paper discusses (among other things of course) how SnR is just a way of predicting future prices- just like any other time series analysis methods which are actually touted by academics.

To cut a long story short, technical indicators like support and resistance may have merit to their usage- either because of overuse and the self-reinforcing phenomena or perhaps there's a statistical explanation to it which academics are trying to decipher. It could also be, like I showed with a very simple (yet, I'll admit, not so robust) test, that it could simply be us humans seeing patterns when there really was never one- just markets fluctuating like they should.

I for one am tricked into thinking there's a support or a resistance every time I look at a chart. I'm not infallible.

What about you?

Let me know if you'd like me to post the code I wrote here...