Geometric Moving Average (GMA): the 'n'th root product of 'n' numbers,
For example,( Return1* Return2 *?* Return n)**(1/N). Value Line used and
probably still uses a geometric MA to compute returns.
So for example:
10,100,100;
GMA=(10*100**1000)**(1/3) =100.
2,4,8,16;
(2*4*8*16)**(1/4) = 5.657
In
AFL:
/*
Formula
Derivation
C1 =
Ref(C,-1);C2 = Ref(C,-2);C3 = Ref(C,-3);Cn = Ref(C,-n);
GMA = Nth root
of:(C*C1*C2*C3*C4*...*C(n-1))
lnGMA =
(1/N)(ln(C)+ln(C1)+ln(C2)+ln(C3)+...+ln(Cn-1))
=(1/N)*Sum(ln(C),N)
GMA =
exp(lnGMA);
*/
/*
//Number
examples
Period =
Param("Period",1,1,100,1);
//Numbers:
10,100,1000; period = 3;
lnGMA =
(1/period)*(ln(10)+ ln(100)+ln(1000));
//Plot(exp(lnGMA
),"GMA",1,5);
//Numbers:
2,4,8,16; period = 4;
lnGMA =
(1/period)*(ln(2)+ ln(4)+ln(8)+ln(16));
Plot(exp(lnGMA
),"GMA",1,5);
*/
//In AFL
language
Period =
Param("Period",1,1,100,1);
lnGMA =
(1/Period)*Sum(ln(C),Period);
Plot(exp(lnGMA),"GMA",1,5);
From: amibroker@xxxxxxxxxps.com
[mailto:amibroker@yahoogroups.com] On Behalf Of Howard
B
Sent: Thursday, January 08, 2009 12:09 PM
To:
amibroker@xxxxxxxxxps.com
Subject: Re: [amibroker] Geometric
Moving Average (GMA)?
Hi Mav --
This is one definition of geometric moving average:
"A
geometrical moving average gives the most recent observation the greatest
weight, and all previous observations weights decreasing in geometric
progression from the most recent back to the first."
That is also the
definition of exponential moving average.
Do you have something else in
mind?
Thanks,
Howard
On Thu, Jan 8, 2009 at 1:19 AM, MAVIRK <mvirk67@xxxxxxcom> wrote:
Any one has AFL code for
Geometric Moving Average (GMA)?