How to calculate SigmaSpikes?

Grant_mechanical_calculating_machine_1877I’ve received a few questions about how to calculate a measure I have referred to many times here on my blog and in my published research that I call SigmaSpikes. I’ve disclosed the calculation in several places, but the question keeps popping up, so maybe I need to do it more clearly! First, a little history on how I came up with the measure, or, well, reinvented the wheel:

I think most of us who are involved with markets for any length of time begin to realize that volatility is important. (Yes, that statement is a dramatic understatement.) I did a lot of my early semi-quant work in a vacuum, so I didn’t know what everyone else had already done; I created really cool and useful tools that were–ultimately–things that everyone else was already using. Though I kind of smile at my naivety now, I think that process was an important part of my development and learning, so it wasn’t wasted time.

When I began to think about volatility, I came up with the idea that different markets traded with different volatility levels (true), that it would be a good idea to have some way to compare volatility across markets (very true), and that each market probably had a base volatility level I could expect it to return to. (The last idea is not true in any practical or meaningful way, but two out of three wasn’t bad.) My first attempt was to look at each day’s move as a multiple of the average range of the market over some time window. I played with different time windows and decided that a month was about right for how I traded–any longer, and it would be too slow to respond to any change in volatility, and much shorter was so unstable that it wasn’t useful. I settled on 20 trading days as a nice round number and used it for my baseline calculations.

The next evolution was to use true range instead of range. This is a small difference, but it really is better: for one, it automatically catches overnight gaps and considers them in the volatility of the market. Another point that is often overlooked is that ATR allows us to use “close only” data series in range calculations, and I was also beginning to use some economic data in my work that had no range associated with each period, just a single datapoint.

Here’s an important point, and it’s probably the most complex of this post: “time leakage” is a real problem in any kind of testing or development. If you create a system and even slightly reference a seemingly insignificant datapoint you could not have had at the time, your system results will likely look very good, but they’ll also be completely invalid. We must be very careful to only use data we would have had at the time. The best way to measure this volatility ratio seemed to me to measure against yesterday’s ATR, because we don’t know what today’s was until the close of the bar. A very big day today will inflate the baseline, making that big day seem smaller, by comparison, than it would have been to a trader at the time. So, I offset the calculation to measure today’s range against yesterday’s 20 day average range.

[box type=”info”] This question frequently comes up on trading forums: a “return”, in finance, is just a percent change. This is standard language in any academic or mathematical finance, but not so much in the literature of technical analysis. A return is simply a percent change, so a daily return is the % change for the day.)[/box]

At some point, I began to think that returns were a better way to think about market price. Once you make that leap, standard deviation of returns is an accepted measure of volatility, and is trivially easy to calculate. So, I settled on the idea of looking at each day’s return as a multiple of the 20 day standard deviation, with the measure offset one day, and that’s what I use today.

Since then, I discovered that practically every options trader and risk management system in the world uses this exact calculation (or some slight variation) in their work. It’s a very useful measure, but is by no means unique to my work or perspective. It is, however, a very useful took for looking at market action and price changes, quickly assessing volatility, and removing much of the emotional component associated with large price moves over a period of time. More on that, perhaps, in a future post.

There are a number of ways to do this calculation, but here, in bullet points, is what you’re trying to do:

  • Calculate daily returns as: return = today's close / yesterday's close - 1
  • Calculate standard deviation of daily returns over a 20 day window. In quasi-Excel langauge:: stdev = stdev(returns, 20)
  • Calculate today's sigma spike: SigmaSpike = today's return / yesterday's stdev

AdamHGrimes

Adam Grimes has over two decades of experience in the industry as a trader, analyst and system developer. The author of a best-selling trading book, he has traded for his own account, for a top prop firm, and spent several years at the New York Mercantile Exchange. He focuses on the intersection of quantitative analysis and discretionary trading, and has a talent for teaching and helping traders find their own way in the market.

This Post Has 5 Comments

  1. Adrian

    Adam, when you calculate SigmaSpikes, do you take into account splits and/or dividends? To get accurate returns, it should (of course, ignoring splits is more problematic than ignoring dividends in this respect). But this complicates the calculations.

    1. Adam Grimes

      Depends how you are doing it and what you are trying to accomplish. Here, we’re really focused on the one day returns and how those fit into the overall volatility of the market. For that, you may be able to safely ignore dividends.

      There are a number of ways to adjust for dividends and splits, and once you have the adjusted data series the calculation is the same.

  2. Michael Slattery

    Hello Adam: Do you see this indicator as providing entry / exit signals or just a market volatility tool?

    1. Adam Grimes

      Not sure exactly what you’re asking. I don’t think any indicator reliably provides entry exit signals (that’s not at all how I use indicators), but I also don’t know what “just” a market volatility tool means. I’ve written pretty extensively about how I use tool, and it is one of the most useful frameworks I’ve found for understanding market action and behavioral factors baked into price action.

  3. Adrian

    Just a side note on Sigma Spikes description from QuantitativeAnalysisOfMarketDataAPrimer.pdf: I don’t know if that document was updated in the meanwhile, but the version that I downloaded, on page 5, 4th step on how to calculate the spike, has a typo: it says “×”, it should say “/”.

Comments are closed.