PureBytes Links
Trading Reference Links
|
Bob,
Yep ! That looks like the reason for the differences.
I just tested with the "daily" factor in place of
the "weekly" factor in Anthony's code.
All seems to work ok.
Thanks again for the help.
Gosub283
--- In amibroker@xxxxxxxxxxxxxxx, "Bob Jagow" <bjagow@xxxx> wrote:
> Bob/John =47.8/47.46 == sqrt(260/256).
> Anthony's factor is 365/7 = 52 weeks, so the input is presumably in
> weeks.
>
> Bob
>
> -----Original Message-----
> From: gosub283 [mailto:gosub283@x...]
> Sent: Friday, September 10, 2004 1:29 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] OPTIONS afl code (John, Bob, Anthony
Faragasso.)
>
>
>
> Gentlemen, (Bob, John, Anthony, and anyone else)
>
> John and Bob, thanks for the feedback...
>
> I don't want to start a fight :-) but there seems to be some
> discrepancy in the results of the posted "Historical Volatility"(HV)
> code snippets. Bob's and John's seem to be similar in result.
> But Anthony Faragasso's post of Dec.29/03 returns significantly
> different results. Significant enough to mess up a trade :-)
>
> I visited the www.optionclub.com calculator and used the "QQQ"
> as a test.
> I set all code snippets to provide a 20 day HV value to compare.
> The HV chart at OptionsClub concurs with Anthony's code.
> 20 day historical volatility of QQQ...
> John: 47.46
> Bob: 47.8
> Anthony: 20.6
> OptionClub: 21
>
>
> I am posting this because these are important values to traders
> and being that I am not an accomplisher AFL coder, I am hoping
> that as group, we can determine which snippet is most accurate.
> Hopefully this will benefit all involved.
>
> Codes are below.
> Result at the bottom of each section.
>
>
>
> =========== Bob Jagow's Post =====================
>
> // Bob, for comparison purposes, I adjusted the
> // one of the periods from 100 to 20
> function hv(period)
> {
> return StDev(log(C/Ref(C,-1)),period)*100*16;
> }
> hv20 = hv(20); hv6 = hv(6);
> Plot(Hv6/Hv20,"s/lv",4);
> Plot(Hv6/Hv20,"hvs/hvl",7);
> Plot(1,"",7,4);
> Plot(Hv20,"hv20",5,styleOwnScale);
> //Filter = Hv20 > 50 AND ADX(14) > 30;
> //AddColumn(Hv100," hv ",2.1);
> //AddColumn(Hv6/Hv100,"hv ratio",2.1);
> //AddColumn(ADX(14),"ADX14");
> //AddColumn(PDI(14) - MDI(14),"dir");
>
> ****** shows "QQQ" 20 day volatility as 47.46 *****
>
>
> ============= John Gibb's Post ====================
>
> yr_days=Param("yr_days",260,260,365);
> pd1=Param("pd1",6,6,200,2);
> pd2=Param("pd2",100,6,200,2);
> hv1=StDev(log(C/Ref(C,-1)),pd1) * sqrt(yr_days)*100; <===Here
> Hv2=StDev(log(C/Ref(C,-1)),pd2) * sqrt(yr_days)*100;
> Plot(Hv1,"", colorBlue, 1);
> Plot(Hv2, "", colorOrange, 1);
> Title="x-day HVs & ratios:
> \n"+EncodeColor(colorBlue)+NumToStr(pd1,1.0)+"-Day:
> "+WriteVal(hv1,1)+"%"+EncodeColor(colorOrange)+"\n"+NumToStr
(pd2,1.0)
> +"-Day:
> "+WriteVal(hv2,1)+"%"+EncodeColor(colorRed)+"\n"+NumToStr(pd1,1.0)
+"-
> Day/"+NumTo\
> Str(pd2,1.0)+"-Day:
> "+WriteVal(hv1/hv2,1.2);
> GraphXSpace=3;
>
> ****** shows "QQQ" 20 day volatility as 47.8 *****
>
>
>
> ============= Anthoy's Post =======================
>
> From: "Anthony Faragasso" <ajf1111@xxxx>
> Date: Mon Dec 29, 2003 2:52 pm
> Subject: Re: [amibroker-afl] Historical Volatility
>
> /* Historical Volatility */
>
> Period1=20;
>
> Period2=90;
>
> Volatility1 = StDev(log(C/Ref(C,-1)),Period1)*sqrt(365/7)*100;
> <===Here
>
> Volatility2 = StDev(log(C/Ref(C,-1)),Period2)*sqrt(365/7)*100;
>
> Plot(Volatility1,"\n"+"Volatility1 [ "+WriteVal(period1,1)+"
> Period ]",colorRed,styleLine);
>
> Plot(Volatility2,"\n"+"Volatility2 [ "+WriteVal(period2,1)+"
> Period ]",colorBlue,styleLine);
>
> ****** shows "QQQ" 20 day volatility as 20.6 *****
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/
|