Page 1 of 1

Measuring annual volatility?

Posted: Fri Feb 18, 2011 4:18 pm
by comewish
Thank you for the equity curve blending post (link), Sluggo. This must cost you a lot of time and hard work.
May I ask a question?
How do you mesure annual volatility?

Posted: Fri Feb 18, 2011 6:17 pm
by sluggo
Annual volatility = daily volatility x squareroot(#days_per_annum)

Trading Blox Builder provides the daily volatility of the equity curve return series. It is a built-in function, called
  • test.dailyReturnStandardDeviation
I trade (and run backtests) with a large, globally diversified portfolio, so SOMETHING is trading every single weekday, somewhere. Thus my equity curves from Blox have a data point on every single weekday. That means in my tests, #days_per_annum = 261.

When market M in country C takes a holiday, some other market in some other country is open and trading. TOCOM Gasoline trades on Dec 25th (Christmas), LIFFE Robusta Coffee trades on July 4th (US Independence Day), EUREX EuroBund trades on Cinco de Mayo, etc.

Therefore

Code: Select all

test.AddStatistic("Annual Volatility", (squareRoot(261) * test.dailyReturnStandardDeviation))
will do the trick -- if your equity curve has got 261 datapoints per year, as mine does.

If you only trade 1 market, or just a few markets all in the same country, you probably have about ~ 250 equity curve data points per year, due to holidays.

It would be a fun and medium-difficulty problem, to write an After Test script for Blox which (a) counted the number of points in the equity curve, (b) did some math calculations upon the date properties test.testStart and test.testEnd, and then (c) calculated the #days_per_annum, to six significant figures, for this particular backtest using this particular portfolio. Since this code would run in the After Test script, and not once per day (and certainly not once per day, per instrument), its contribution to the total simulation running time would be negligibly small.