Hi,

If using trading days, the 260 figure does not take into consideration the 
various holidays, but rather is just the number of calendar days minus the 
number of weekend days.

Running a simple Scan on EOD data will show that US markets typically have 
about 252 trading days/year, ranging from 251-253. The exception being 2001, 
which had 248 days, due to additional closures caused by the 9/11 attacks. 

// Set AA window Range from 1st of year to end of year then run Scan
Buy = Sell = 0;
firstBar = LastValue(ValueWhen(Status("firstbarinrange"), BarIndex()));
lastBar = LastValue(ValueWhen(Status("lastbarinrange"), BarIndex()));
_TRACE("" + (lastbar - firstbar + 1));

Try again the formula suggested earlier using 252 instead of 260 and see if it 
gets you any closer to your target.

Mike

--- In amibroker@yahoogroups.com, "potatosoupz" <potatoso...@...> wrote:
>
> Thanks, I think your formula is correct, except you should be multiplying by 
> 260, not 365, since 260 reflects actual trading days.
> 
> See here: http://www2.barchart.com/support/learning.asp?what=hisvol&code=BSTK
> 
> When I change your formula to 260, the results look very close to what is 
> found on IVolatility.com. Let me know what you think.
> 
> --- In amibroker@yahoogroups.com, "Anthony Faragasso" <ajf1111@> wrote:
> >
> > here is how I calculate Historical volatility: ( 20 period )
> > 
> > hv1=20;
> > vl= StDev(log(C/Ref(C,-1)),hv1)*sqrt(365); 
> > 
> >   ----- Original Message ----- 
> >   From: Potato Soup 
> >   To: AmiBroker (Discussion List) 
> >   Sent: Saturday, November 14, 2009 9:33 AM
> >   Subject: Re: [amibroker] Re: Trying to plot historical volatility with AFL
> > 
> > 
> >     
> >   Thx but they are showing historical or realized volatility, not implied 
> > as far as I can tell. 
> > 
> >   More to the point is what I'm doing correct or are there other preferred 
> > methods of calculating historical volatility? 
> > 
> >   -----Original Message----- 
> >   From: "dbwyatt_1999" <dbw451@> 
> >   Date: Sat, 14 Nov 2009 14:01:24 
> >   To: <amibroker@yahoogroups.com> 
> >   Subject: [amibroker] Re: Trying to plot historical volatility with AFL 
> > 
> > 
> > 
> >   I'm not familiar with ivolatility.com, but I would guess they are 
> > calculating an implied volatility based on closing SP option prices using 
> > an option pricing model like Black-Scholes. 
> > 
> >   Regards, 
> > 
> >   David 
> > 
> > 
> >   --- In amibroker@yahoogroups.com, Potato Soup <potatosoupz@> wrote: 
> >   > 
> >   > I'm trying to plot the 30 day historical volatility of the S&P 500, 
> > using the following AFL on a daily chart with around 2 years of end of day 
> > prices for the S&P 500: 
> >   > 
> >   > Plot(StDev(Close, 30),"Historical Volatility", colorOrange,styleLine); 
> >   > 
> >   > However when I look at the values, they appear to be a bit off to what 
> > I see when I look online here: 
> >   > 
> >   > 
> > http://www.ivolatility.com/options.j?ticker=SPX:CBOE&R=1&period=12&chart=2&vct=
> >  
> >   > 
> >   > For today they have 18.99, where as my chart shows 19.348. All my other 
> > values going back further don't match their chart either. Any ideas, are 
> > they calculating it differently than just a simple standard deviation? 
> >   > 
> > 
> > 
> > 
> >   ------------------------------------ 
> > 
> >   **** IMPORTANT PLEASE READ **** 
> >   This group is for the discussion between users only. 
> >   This is *NOT* technical support channel. 
> > 
> >   TO GET TECHNICAL SUPPORT send an e-mail directly to 
> >   SUPPORT {at} amibroker.com 
> > 
> >   TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at 
> >   http://www.amibroker.com/feedback/ 
> >   (submissions sent via other channels won't be considered) 
> > 
> >   For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: 
> >   http://www.amibroker.com/devlog/ 
> > 
> >   Yahoo! Groups Links
> >
>


Reply via email to