Quote from thenewguy:
what do you mean by that?
Quote from thenewguy:
i mean, given the stock price, strike price, call price, interest rate... etc there should be a way to derive it using the black-scholes formula, correct?
Thanks,
The New Guy
public class OptionMath
{
const double AnualTradingDays = 260.0;
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[i]/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
double annualVolatility = v*Math.Sqrt(AnualTradingDays);
return annualVolatility;
}
}
Quote from 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
{
const double AnualTradingDays = 260.0;
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
double annualVolatility = v*Math.Sqrt(AnualTradingDays);
return annualVolatility;
}
}
Quote from kut2k2:
This latter is a fallacy. [...] 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.
But the rest of these volatility estimators look ad hoc, with a lot of hand-waving to rationalize them.
I think the basic idea is that you can always get more information about volatility by looking at a shorter timescale. The more information you have the faster your estimate will converge, resulting in a more responsive estimator. However intraday data is difficult to work with, and less widely available than end of day data. Open-high-low-close bars provides some information about intra-period volatility and results in a slightly faster estimator than open-close bars.I don't have access to a university library to look up academic papers.