How to calculate stock volatility in %?

How can I calculate the stock volatility in percentage?
Do i have to use sd() function without any other calculation ?



You’re looking for the standard deviation of log returns, appropriately annualized and converted to percentage (i.e. multiplied by 100).

Here is an example of computing annual vol from daily prices:

data <- get.hist.quote('VOD.L')
price <- data$Close
ret <- log(lag(price)) - log(price)
vol <- sd(ret) * sqrt(250) * 100


  1. The above code should really be using prices adjusted for corporate actions (dividends, splits etc).
  2. 250 is the (approximate) number of trading days in a year.

Source : Link , Question Author : ECOtime , Answer Author : NPE

Leave a Comment