[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Historical Volatility Calcs



PureBytes Links

Trading Reference Links

Possible cause of the discrepancies may be the use of the sample 
standard deviation instead of the population (like AFL StDev) or yet 
another, like the non-centered (described in the AT article).

function SD_pop(input,n)
{ return sqrt( (n*Sum(input^2,n)-(Sum(input,n))^2) / n^2 ); }

function SD_sam(input,n)
{ return sqrt( (n*Sum(input^2,n)-(Sum(input,n))^2) / (n^2-n) ); }

function SD_nnc(input,n)
{ return sqrt( Sum(input^2,n) / n ); }

And of course some may use a different default period like 365. 
Especially when theta is your thing using the total number of days 
may be more accurate, since time decay does progress during weekends 
and holidays. For comparison most important would seem to use the 
same period in both HV and IV calculations.  
 

--- In amibroker@xxxxxxxxxxxxxxx, "Phsst" <phsst@xxxx> wrote:
> Been playing with HV Calcs this weekend using following AFL code:
> 
> per = Param( "Volatility Period", 20, 2, 365 );
> days = Param("History days in Calc", 252,1,365); 
> Plot(100*StDev(log(C/Ref(C,-1)),per)*sqrt(days),"Volatility",3,1);
> 
> NOTE: 'days' default represents number of trading days in year 
rather
> than calendar days. (Don't split hairs about anything between 250 
and
> 256, since none of those values changes things much)
> 
> Example code was applied to GE daily chart and yields an HV 20day 
> result of 8.98457 using default Params.
> 
> I've researched enough to feel comfortable with the formula and 
Params
> which were posted on this forum quite a long time ago.
> 
> But when I go to three (3) different web sites which are reputed to 
be
> 'expert' sites, I see three different values for current Historical
> Volatility (all of which differ from my calculated result).
> 
> www.optionclub.com shows HV 20day value of 12.0
> www.optionstrategist.com shows HV 20day value of 10
> www.ivolatility.com shows HV 20day value of 13.74
> 
> Beats me how a universally accepted formula can yield such a diverse
> set of results.
> 
> Anyone see anything obvious?





------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hb0o62n/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123577023/A=2894350/R=0/SIG=10tj5mr8v/*http://www.globalgiving.com";>Make a difference. Find and fund world-changing projects at GlobalGiving</a>.</font>
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/