Forums ProRealTime English forum ProBuilder support The prt STD formula is not the appropriate one Reply To: The prt STD formula is not the appropriate one

#113078

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:

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