25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music  

Stock price volatility calculator for option valuation formulas

On this page you can compare the historical volatility of a stock price as calculated by 4 different methods.

Volatility is a variable required by the Black-Scholes stock option valuation equation

As you will see, the calculated values can differ widely.

You can compare how volatilities affect estimated option valuations in the option price calculator.

Instructions:

  1. Get the underlying stock's daily closing prices for the time interval you want to measure, such as 1 year1. Historical price data is available at Yahoo! Finance.
  2. Copy and paste the list into the Paste Prices box below. (The data should contain no characters except .0123456789. All others will be converted to spaces.)
  3. The program expects the data to be sorted with the oldest price at the top of the list1. Data from Yahoo! Finance is upside-down (most recent price at top). If necessary, click Reverse to reverse the list. 
  4. Click Calculate.
  5. Volatilities are output as decimals. To convert to a percent % (which is expected by most option valuation routines), multiply by 100. For example, 0.3204 becomes 32.04%.
Paste Prices,

Description of method Annualized volatility by this method
1) Black-Scholes volatility: standard deviation of the underlying stock price's daily logarithmic returns, annualized. Given the daily stock prices2, each data point is calculated as:

NaturalLog(Pricetoday / Priceyesterday)

The standard deviation (N-1 weighting) of this set of daily data points is then annualized using the number of trading days in a year3:

StdDevannualized = StdDevdaily * SQRT(252)

 
2) Rule Of 16: the average magnitude (absolute value) percentage price change per day (calculated arithmetically, not lognormally), multiplied by 16.   
3) Old Shortcut: (High - Low) / (High + Low). The origin of this method is probably that (H-L)/2 = Half the price range, and (H+L)/2 = The "average" price, between the two extremes. The 2's cancel out. It calculates the percent of its average price by which the stock deviated above and below its average price, computed by the only method that is possible if only the High and Low prices for the period are known, which was common when historical stock price data was expensive to get.  
4) The standard deviation of 1 year of daily stock closing prices, divided by the average price for the year4: intended as a more conservative refinement of method #3, it is not the input the Black-Scholes equation requires.   

References

A very technical discussion of the Black-Scholes equation is at Wikipedia. It links to this page about financial volatility, which in turn links to the formula for volatility as required by Black-Scholes, in the "Logarithmic or continuously compounded return" section of this page

Notes

1) The number of input values needed, and whether their sort order is significant, depends on the method:

  1. Black-Scholes takes 1 year (252 trading days) of price changes, so it needs 253 closing prices, but omitting one day in 252 should make little difference. The order of the input values is significant, but only somewhat. The first value encountered is only used as a starting point for calculating the first price change. The sort order determines which value in the list is used as that starting point and otherwise ignored: the oldest value, or the most recent. Besides that, however, the internal calculations don't care whether the list is in oldest-to-newest or newest-to-oldest sort order, so the effect of sort order on the output should be small. 
  2. Rule Of 16 also operates on price changes, so it needs 253 input values. Order is significant, possibly slightly more than for #1 Black-Scholes.
  3. Old Shortcut only extracts and uses two values, the High and Low in the input set. It doesn't require anything more than those two values, and order doesn't matter. 
  4. Standard deviation is calculated on the closing prices, not price changes, so it takes 252 inputs. Order doesn't matter, except for rounding errors in the last decimal places.

2) If you are only using method #1 (Black-Scholes volatility), you can actually enter as many or as few daily prices as you want, as long as the values are from consecutive trading days. The more daily prices you enter, the more long-term the estimate will be. If you enter only 5 days of data, the volatility estimate will still be annualized, but it will be based on the volatility history of only the past 5 days, during which the volatility might have been very abnormal compared to what it normally is over the course of an entire year. Nonetheless, that might be what you want if your outlook is very short term and you only want to know what the volitility is likely to be during the next 5 days. 

3) The operand of SQRT is how many of time intervals we measured are contained in each time interval we want to estimate. Given monthly stock prices, the annualization calculation would use SQRT(12/1): 

StdDevannualized = StdDevmonthly * SQRT(12/1)

To calculate volatility per trading day (or calendar day) from the annual volatility:

StdDev1TradingDay = StdDev1Year * SQRT(1/252)
StdDev1CalendarDay = StdDev1Year * SQRT(1/365)

Volatility for the shorter period should always be less than for the longer period. 

3a) Instead of the whole number 252, this routine uses a trading-days/calendar-days calculation that gives 251.8928571 as the average number of trading days in the average 365.25 calendar days in a year.

4) To get this figure for one year, enter into a statistical calculator the closing price of the stock for each day for one year. Then hit the "standard deviation" key, and you will get a number that is the standard deviation of the stock price for that year. To make it a percentage (fraction) of the average stock price, divide it by the average of the daily closing prices over that one-year period, which you can calculate using the same data you just entered by pressing the "arithmetic mean" (average) key () on the calculator. Turning the result into a percentage of the average price for the year satisfies the requirement that the value be expressed as a fraction, and the average price over the course of the year is the only number that it is reasonable to make it a fraction of. There is a statistical calculator that can help with this computation. 

5) The Black-Scholes volatility figure makes it possible to calculate probabilities of the stock price staying within, or exceeding, a given range over a period of time.

6) However, the accuracy of those predictions, and also of the Black-Scholes model itself, depend on a) price fluctuations being normally (or rather, lognormally) distributed with a standard deviation equal to the Volatility figure, and b) the Volatility being consistent over time. It is often largely ignored that neither of those assumptions is true. Someone who noticed many years ago the non-normality of price distributions and occurrences of volatility spikes was Benoit Mandelbrot, who has written a book called The Misbehavior of Markets: A Fractal View of Financial Turbulence. Mandelbrot: Misbehavior of Markets

7) Questions, comments, and suggestions for improvement are welcome in the discussion forum.

8) Most options traders lose money. If you use these volatility estimates, you will probably lose money trading options. If you don't use these volatility estimates, you will probably lose money trading options. You will probably lose money trading options no matter what calculations you do or what methods you try.


 

Valid HTML 4.01 Transitional
Yahoo! Search
Search the web Search this site
Valid CSS