General Topics
Technical Topics
Brokerage Firms
Community Lounge
Site Support

# Total rookie question....

Discussion in 'Options' started by thenewguy, Jul 22, 2005.

1. ### thenewguy

Hi, I'm just starting to get in to options, and I was wondering how most traders calculate historic volatility?

I'd really appreciate it if some traders take the time to answer this newb question.

Thanks!

The New Guy

the standard deviation of the movement of the stock historically. excel has a function to calculate this.

3. ### thenewguy

fantastic, thanks for your reply. very familiar with excel, so that should be no problem. i assume you use a timeframe similar to the time til expiration for the option in question?

Thanks

The New Guy

4. ### GTG

I use the method as described on pages 461 and 462 in Options as a Strategic Investment by McMillan. Basically you take the log of the ratio of each day's price and the previous day's price.

Then you compute the standard deviation of those values.

Next, multiply the standard deviation by the square-root of the number of trading days in a year to convert to an annualized volatility so that you can use it in the Black-Scholes model.

Here's my C# source code to compute a series of historical volatilities.

public class OptionMath
{

public static double[] HistoricalVolitilitySeries(double[] prices, int period)
{
Debug.Assert(prices.Length-1 >= period);

double[] v = new double[prices.Length-period];

for (int j=0,i=1; j < v.Length; j++,i++)
{
v[j] = HistoricalVolitility(prices, i, period);
}

return v;
}

public static double HistoricalVolitility(double[] prices, int index, int period)
{
double[] P = prices;
double[] X = new double[period];

double mean = 0;

// get the logarithms of the daily price ratio
for (int j = 0, i=index; j < period; j++,i++)
{
X[j] = Math.Log(P/P[i-1]);

mean += X[j];
}

// compute the mean of the logarithms of the price changes
mean /= period;

// compute the deviations from the mean
double sum = 0;
for (int k = 0; k < period; k++)
{
double d = (X[k] - mean);

sum += d*d;
}

// standard deviation of the daily volatilities over the period
double v = Math.Sqrt(sum/(period-1));

// scale to an annualized value for use in the BS equation

return annualVolatility;
}
}

5. ### thenewguy

very nice, thanks for going above and beyond too.

The New Guy

6. ### Sparohok

There are a variety of volatility estimators some of which perform better or converge faster than a simple standard deviation, and are included in Peter Hoadley's option tools:

All except GARCH models are very easy to replicate in a few dozen lines of code from the references in Hoadley's FAQ.

Martin

7. ### kut2k2

What's the theoretical basis or justification for using something other than the standard deviation? TIA.

8. ### Sparohok

Open-high-low-close estimators converge faster and with a given amount of data tend to produce a more accurate result. If your strategy is sensitive to fast changes in volatility you might want to use a shorter window with one of these estimators.

Similar logic applies for exponentially weighted moving averages, for any time series, not just volatility. EWMAs react faster than a plain moving average yet still incorporate longer term historical trends to some extent.

GARCH incorporates mean reversion and volatility clustering, which theoretically makes it a stronger estimator since these are well known characteristics of volatility. Unfortunately it is also somewhat unstable. For me, GARCH has always proven to be more of a hassle than it is worth.

But, I recommend you look up the original papers because they go into much more detail and use hard data to justify their estimators.

Martin

9. ### kut2k2

This latter is a fallacy. I can see the theoretical basis for the standard deviation definition of volatility, if we accept all the assumptions that allow Black-Scholes to operate. But the rest of these volatility estimators look ad hoc, with a lot of hand-waving to rationalize them.

EMA has the exact same lag characteristic as the simple moving average. Those who claim it is closer to the weighted moving average ignore the fact that the EMA represents an infinite series, whereas the SMA and WMA are finite series.

Thanks for the info on GARCH.

10. ### thenewguy

does anybody know the formula for implied volatility as well?

TIA,

The New Guy

#10     Jul 25, 2005
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS: