Actually one does need to take the Log if one is going to follow the
standard method for calculating volatility. However I think you would
also need to calculate the volatility on an annualized basis (252 days)
and then look back to the period you are interested in exploring.
This is from CRB
HISTORICAL VOLATILITY (20-day):
STEP 1
For the past 20 days, calculate: today's close / previous close (requires 21 days of data)
STEP 2
Calculate the natural log of the results calculated in STEP 1.
STEP 3
Calculate the sum of the natural logs over the past 20 days.
Calculate the sum of the squares of the natural logs over the past 20 days.
STEP 4
Divide the sum of the natural logs by 20.......................#1
Divide the sum of the squares of the natural logs by 20........#2
Calculate: RESULT 2 - the square of RESULT 1...................#3
Calculate the (square root of RESULT 3) x (sq. root of 252) x 100
This is the 20-day historic volatility for today.
I would highly recommend that the user have a look at both QC
volatility fields for a given instrument and also at a site such as
iVolatility where you can find graphs of volatility to compare to your
results.
By the way, it should be noted what the user is looking at calculating
here is historical volatility using the standard method. There is also
Parkinson's method which uses ratios. You will get a similar looking
volatility shape but very different numeric values.
Bottom line? If you are trying to use the industry standard measure of
historical volatility you need to use this sort of formula:
pds:=Input("Volatility Period",0,252,5);
volatility:=Stdev(Log(C/Ref(C,-1)),pds)*Sqrt(252)*100;
volatility;
There are many ways to skin the Volatility cat. This is just the basic
approach to historical vol. But this will give you the base line result
that is the industry norm. Remember there are four types of Volatility
-- historical, future, expected, implied. You will have to do
completely different calculations for the other three forms.