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

Re: [amibroker] Accuracy of weekly ema calculation



PureBytes Links

Trading Reference Links

Hello,

Yes you are doing the error.

You should switch the chart to weekly interval
to calculate weekly EMA.  
====================================

Weekly EMA must be calculated from weekly data
======================================
and only then you can compare it to output of other programs.
Also -- different programs differently "initialize" EMA.
Since EMA is recursive the first value (after the first period-elements)
must be initialized somehow. MS and AB use simple MA to initialize
first element of EMA, but some other packages work differently.

Calculating weekly EMA from daily data without switching
to weekly interval is possible however requires much more complex
code that yours. It is better for you to take a look at TimeFrame.dll
that will do this for you:
http://www.amibroker.net/3rdparty.php

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Michael Orlyk" <bmwrider@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, March 14, 2003 11:59 AM
Subject: [amibroker] Accuracy of weekly ema calculation


> Out of curiosity I decided to compare the accuracy of weekly EMA 
> calculations against other programs.  I had a niggling feeling that I 
> would find a disagreement.  Not to my surprise the EMA values 
> produced by AB did not agree with the values produced by three other 
> programs.
> 
> The other three programs produced EMA values that agreed with each 
> other but not with AB's results.  I am now trying to find an 
> explanation for the discrepency.
> 
> Below,is the script I am using in AB to get weekly EMA values doing 
> an explore on selected equities.  For this test I am calculating a 30-
> week EMA.
> 
> Filter = 1;
>  
> ws = DayOfWeek() < Ref( DayOfWeek(), -1 );
> we = DayOfWeek() > Ref( DayOfWeek(),1);
> 
> WCl = ValueWhen(we, Close);
> wv = ValueWhen(we, Sum(V,5));
> 
> AddColumn(WCl, "Close");
> AddColumn(EMA(WCl,150), "EMA");
> AddColumn(Cross(WCl, EMA(WCl,150)), "Cross");
> 
> Do I have an error in the above?  Is there an inherent error in the 
> process that I am unaware of?  After I discovered this problem, I no 
> longer trust AB's results in so far as weekly calculations are 
> concerned.  Note that what I am doing involves processing in both 
> weekly and daily timeframes so setting AB's periodicity to weekly is 
> not an option. Any comments would be appreiated.
> 
> Mike O.
> 
> 
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
> 
> 
> 

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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