Wednesday, August 12, 2009

The distribution of returns over time

I have noticed that when testing trading strategies, the results improve if I normalize price movements over time based on recent volatility. I decided to determine what the best normalization method is. To do this, I have tested several normalization techniques to see how constant the distribution of returns is over time.

I tried three normalization techniques:
  1. ATR normalization: (close[0]-close[1])/atr[1] - the change in price divided by the Average True Range
  2. variance normalization: (close[0]/close[1]-1)/sqrt(sma(daily variance)) - the percent change in price divided by the square root of the mean of the squares of the percent change
  3. volatility normalization: (close[0]/close[1]-1)/sma(abs(daily percent change)) - the percent change in price divided by the mean of the absolute value of the percent change

I tried all of these methods with lookback periods ranging from 1 to 100 days. Then I split the distributions of the normalized returns into 100 day chunks and compared all of them with the 2-sample Cramer-von Mises test. My data is the first 4100 days of returns on SPY, which goes from Jan 29, 1993 to May 8, 2009. Since the samples were broken up into 41 groups, there were 820 pairs of distributions to compare. This should provide a reasonably good estimate of how constant the distributions are.

After calculating the distribution of the test statistic for each set of normalized returns, I compared them to a randomly generated distribution using the Cramer-von Mises test again. This tells me how well the assumption that the normalized returns come from a constant distribution matches the observed returns.

The following graph shows the results in terms of p-scores. The x-axis is the period of the normalization method. The y-axis shows the probability that the test would have given a better result if the normalized returns actually all came from the same distribution (in other words, it is roughly the probability that the distribution is not constant).

The blue line shows the atr normalized returns, the green line shows the variance normalized returns, and the red line shows the volatility normalized returns. It is clear that volatility normalization still leaves a lot of variability in the distribution of returns.

It looks like the ATR normalization works fairly well for an ATR setting in the range of 14-21. The distribution of returns still changes some, but not substantially. The variance normalization works even better and is pretty good with a period of 11-19. The minimums are both at 16 (which is probably a coincidence).

Something interesting to do with normalized returns is to look at what the market would have done if volatility had been constant. The following graph shows what the closing price for SPY would have been if the ATR had been constant (blue), if the variance had been constant (green), and the actual closing prices (red).

In theory, if you rebalance daily based on the ATR, you would be able to produce the returns shown in blue. Of course, the transaction costs would reduce your returns considerably. You could also produce the returns shown in green by rebalancing every day based on the trailing variance, but with the same transaction costs problem.

Notice that the "black swan" we got last fall did not actually have very unusual market activity. It just had high volatility. The normalized distribution of market returns for this past fall include only a small number of extreme days. Using variance normalization, there were no days more than 3 standard deviations below the mean, and only 8 that were more than 2 standard deviations below the mean (out of 254). The expected number is 5.8, so 8 is not very high. The fall seemed very rapid, but the volatility increased at a slow enough rate that people should have been able to see it coming.

Another thing that you can see is that it is quite clear that volatility is actually higher when the market is falling then when it is rising. That is why the volatility adjusted cumulative returns are higher than the normal ones.

This also matters when trying to back-test strategies. Using the adjusted returns keeps the distribution roughly constant, which allows your strategy to make predictions in a constant distribution, rather than trying to guess how the distribution is changing as well as where in the distribution the returns are going to be.

Also, the normalized returns have an almost normal distribution (more so for the ATR normalization than the variance normalization). Which suggests that the reason that stock market returns have fat tails is mostly that the variance isn't constant.

Also note that this probably works better for indices than for individual stocks. Individual stocks have news events that can generate sudden jumps in prices that may not be preceded by increasing volatility. Such events are rarely completely unexpected across an entire index, so major news events tend to be preceded by increasing volatility. Exceptions include things like terrorist attacks and natural disasters (particularly earthquakes and volcanic eruptions that don't provide even a few days of warning the way that hurricanes do). I have not yet tested this on any individual stocks, any other indices, or even SPX before SPY started trading.



Anonymous Anonymous said...

Very interesting!

One question.

How did you calulate the
close prices for the zero
volatility chart?

Great blog!

February 3, 2010 at 8:27:00 AM EST  
Blogger Feanen said...

I just used the normalized percent daily changes and applied them with a constant volatility factor. The Matlab code for the variance normalization is:

for count=2:l

I am also using the adjusted closing prices (adjusted for dividends and splits).

February 3, 2010 at 9:24:00 AM EST  
Anonymous prazor said...


I translated the matlab bit to amibroker. Hopefully correctly.

Maybe i am missing the obvious here but i can't figure out how to transform the normalized percent daily changes.

You apply a constant volatility factor to the normalized change.

Could you give me a hint...

February 4, 2010 at 8:42:00 AM EST  

Post a Comment

<< Home