PureBytes Links
Trading Reference Links
|
Larry,
3 day built-in WMA does the following:
( 3 * Close
+ 2 * Ref( Close, -1 )
+ 1 * Ref( Close, -2 ) )/6;
It is obviously different than your formula.
Your formula has an error in
this that your weights do not sum to one.
The sum of weights in built-in WMA is 3/6+2/6+1/6 == 1
and this is correct.
In your formula:
> e.g. fwma(3 period Close)= (C+2(Ref(C,-1))/3+1(Ref(C,-2))/3)/3 or
> (Close(today) + 2/3xClose(yesterday) + 1/3xClose(two days ago))
> divided by three;
The sum of weights is
1 + 2/3 + 1/3 = 2;
So your average is twice the value of the array which is not correct.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "lazza" <firstpacific@xxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, June 16, 2003 8:16 AM
Subject: [amibroker] Weighted MA
> Can anyone please help me with this indicator.
>
> I want to plot a weighted moving average
>
> e.g. fwma(3 period Close)= (C+2(Ref(C,-1))/3+1(Ref(C,-2))/3)/3 or
> (Close(today) + 2/3xClose(yesterday) + 1/3xClose(two days ago))
> divided by three;
>
> (see fwma, below) but would like to be able to to do it by just
> putting in the time period rather than doing these calculations
> manually and can't figure out how to program it. Could be a bit time
> consuming if I wanted to do a 200 period fwma. In the case below the
> period is 12.
>
> The WMA function in Amibroker gives a different result than my fwma.
>
> Many thanks if you can help.
>
> Larry.
>
> fn1=ROC(C,T1);
>
> fwma=(fn1+11*(Ref(fn1,-1))/12+10*(Ref(fn1,-2))/12+9*(Ref(fn1,-
> 3))/12+8*(Ref(fn1,-4))/12+7*(Ref(fn1,-5))/12+6*(Ref(fn1,-6))/12+5*(Ref
> (fn1,-7))/12+4*(Ref(fn1,-8))/12+3*(Ref(fn1,-9))/12+2*(Ref(fn1,-
> 10))/12+(Ref(fn1,-11))/12)/12;
>
>
>
>
> 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/
>
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->
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/
|