The prt STD formula is not the appropriate one

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #47759 quote
    Jim Moto
    Participant
    New

    Thank you juanj, I will try to use them 🙂

    #47783 quote
    juanj
    Participant
    Master
    #47793 quote
    Despair
    Blocked
    Master

    I also prefer mathematical correctness but in this case I think it finally won’t matter. The difference between STD.S and STD.Pi is so little. But it becomes of course larger the smaller the sample size is.

    Then one can wonder if it is correct at all to use the standard deviation with a shorter period than 20-30.

    I gave it a try and changed the meander bands I coded not long ago which use period of 20. Changing it resulted in really tiny corrections which won’t affect trading I think.

    #47860 quote
    Jim Moto
    Participant
    New


    @Jim
    Moto also see: https://www.prorealcode.com/prorealtime-indicators/regression-statistical-bands-log-normal-v2/

    That is one of the best bands indicator I’ ve never tried 😉 Thank you a lot

    #113078 quote
    Bard
    Participant
    Master

    From ivolatility: https://www.ivolatility.com/help/2.html#hv “To calculate a standard deviation, closing stock prices ( ) are observed over different time frames. We calculate standard deviation for the eight most popular terms: n=10, 20, 30, 60, 90, 120, 150, 180 days on a daily basis. Thus historical volatility can be calculated by the following way.

    Return , where Pt is close price on day t.
    Average day-to-day changes over n-day period can be calculated as sum of returns divided on the number of days. 

    Daily historical volatility calculated on the basis of n days is estimated as

    On IVolatility website we provide annualised Historical Volatility which is calculated as HV=HVdaily*sqrt(252) as we assume 252 trading days in a year.

    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.

    Choosing an appropriate period of observation (n) is not easy. More data generally leads to more accuracy; however, Volatility does change over time and data from deep in the past may not be relevant for predicting the future. The best way for further evaluation is to use a term close to the period considered by most investors or traders.”

    The Historical Volatility  values I’ve found on PRT do not match ivolatility website data and are out by a few percent for the current 30 day HV on the daily S&P 500. The PRT HV code we have is:
    //Historical Volatilit
    annualVol = 252
    HVPeriod = 10 //or 20 or 30
    //periods = 10, where HVol was originally written on PRT as HVol = (sigma * sqrt(annualVol)/periods)
    //Note that dividing by the "periods" just made the % HV result even smaller (obviously) and even further from the ivolatility S&P 500 (current 30 day) HV reading. 
    Returns = log(close / close[1])
    StdDev = std[HVPeriod](Returns)
    HVol = (StdDev * sqrt(annualVol)) * 100
    
    
    The results for the 10 day and 20 day HV however are relatively close ( S&P 500): PRT current 10 day HV = 4.23% v’s ivolatility’s 4.25% and for the PRT current 20 day HV = 5.39% v’s ivolatility’s 5.31%. What I can’t work out is why the result from this above formula works for the 10 and 20 day but for the current 30 day HV it is 4.23% whereas the ivolatility quote is a “massive” 8.54%? https://www.optionseducation.org/toolsoptionquotes/historical-and-implied-volatility Pls see screenshot for quotes and note what you see result wise today is a one day delayed quote from the Options Educations site, i.e. the Options Education org site quote on Monday 18th is from last Friday 15th Nov. So getting back to this std dev summation topic…  to get “Average day-to-day changes over n-day period can be calculated as sum of returns divided on the number of days ” is it necessary to use the “sum” calculations discussed in this thread in the formula I’ve posted? What would that code look like as I’d really like to be able to get PRT’s 30 period volatility quote to match the ivolatility quote? Cheers. *Pls delete first black image
    2.png 2.png 2-1.png 2-1.png
    #113125 quote
    Vonasi
    Moderator
    Master
    The results for the 10 day and 20 day HV however are relatively close ( S&P 500): PRT current 10 day HV = 4.23% v’s ivolatility’s 4.25% and for the PRT current 20 day HV = 5.39% v’s ivolatility’s 5.31%.
    Sunday candles? 10 days on PRT is not the same as the 10 trading days data used in other peoples calculations would be my guess.
    #113212 quote
    Bard
    Participant
    Master
    Cheers, though doesn’t it seems mathmatically improbable that by adding an additional 10 days to the 20 day that it suddenly jumps by 4% difference on the 30 day historical volatility when it was accurate for the 10 and 20 day. I reverse calculated it and you need between a 33 to 34 day PRT HV setting to match the 30 day HV ivolatility result of 8.53%. If there was a Sunday issue wouldn’t we need to deduct (Sun)days from PRT to get it to match what I’m assuming is an ivolatility 5 day trading week, rather than add days?
Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.

The prt STD formula is not the appropriate one


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jim Moto @jim_moto Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/28/2017
Status: Active
Attachments: 5 files
Logo Logo
Loading...