Correct Historical Volatility Formula?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #113130 quote
    Bard
    Participant
    Master

    Which is the correct formula (or approximation) for Daily, 30 Day Historical Volatility (HV)?:

    ivolatility uses the second formula: https://www.ivolatility.com/help/2.html#hv

    I found the first set of code on PRC.

    annualVol = 252
    HVPeriod = 30 
    periods = 7// 1 = intraday chart 7 = daily chart
     
    Returns = log(close / close[1])
    StdDev = std[HVPeriod](Returns)
    HVol = (StdDev * sqrt(annualVol / periods)) * 100

    or:

    annualVol = 252
    HVPeriod = 30
    //periods = 7// 1 = intraday chart 7 = daily chart
    
    Returns = log(close / close[1])
    StdDev = std[HVPeriod](Returns)
    HVol = StdDev * sqrt(annualVol) * 100

    Also shouldn’t it be:

    Returns = log(close [HVPeriod] / close[HVPeriod-1])

    because it’s the sample std deviation we’re calculating?

    Thanks, it’d be good to clear this up as I see it has been discussed in these forums.

    #113131 quote
    Nicolas
    Keymaster
    Master

    I don’t think so, because in this case, in real time, you are calculation a standard deviation offset HVPeriod in the past.

    #113133 quote
    Bard
    Participant
    Master

    “Offset?”

    Why do ivolatility state for HV calculations: https://www.ivolatility.com/help/2.html#hv

    Note: In denominator we use n-1 instead of n to receive unbiased estimate of general dispersion (a square of a standard deviation). This adjustment is essential if we estimate standard deviation on the basis of a small number of observations.

    Same with this quant site in Step #1: https://www.macroption.com/historical-volatility-calculation/

    So wouldn’t n-1 be more appropriate if we’re attempting to calculate small samples of 10, 30 and 30 day returns from 252 periods?

    Also why is there a divide by “periods” in the first formula – what is that doing, is it needed?

    Cheers!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Correct Historical Volatility Formula?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bard @brad Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Bard
6 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/19/2019
Status: Active
Attachments: No files
Logo Logo
Loading...