Cool. I actually already looked at that page.. .. didn't really help out though . . . This is what I got : the daily open, high, close of stock X for a given period time. Do I take the the daily changes in price(today's close - yesterday's close) and simply find the std dev?
It's like this: when IV goes up it is as if the option suddenly has more days to run. When IV goes down, everything behaves as if there suddenly less days to expiration. All curves are round and slow when expiry is still far away. They are sharp and pronounced when expiry is getting close. The whole lifecycle of an option is like re-shaping all curves from round to pronounced. Changes in IV have the corresponding effect. Ursa..
IV : isn't this when the actual market price of an option is used to imply a theoretical volatility to a stock as opposed to the historical volatility.
Here's some java code that I use: double[] closeData = dfc.getCloseData(); double[] logData = new double[closeData.length]; double mean = 0, dev = 0; for (int i = closeData.length - volatilityDays; i < closeData.length; i++) { logData = Math.log(closeData / closeData[i-1]); mean += logData; } mean /= (double)volatilityDays; for (int i = closeData.length - volatilityDays; i < closeData.length; i++) { dev += Math.pow(logData - mean, 2.0); } dev /= (double)volatilityDays; dev *= 252.0; dev = Math.sqrt(dev);
Yes--the option pricing formulas allow you to either plug in a volatility and compute the pricing, or plug in the pricing and compute the volatility. The latter is IV (the volatility IMPLIED by the pricing)
the variable volatilitydays in the above posted java code: is it declared? I'm assuming that it's the number of days that you want to find to hist. vol. for? am I right?
Why when we're looking at volotility we are using 252 days and when we look at T in as in time until expiration with use a full year?
252 is the number of trading days per year (more or less). You can use calendar days in both places if you'd like, but I find trading days more accurate.
Ok. SO what you're saying is that I could use the 365 although my volatility and therefore theoretical option prices would be different? Did you see that I was lost on the volatility days? Isn't really the length of the close array, closeData.length? the method call dfc.getCloseData()? Is that the way you open the file with closing prices?