Anyone have any AFL code for calculating a geometric average of a data set?

I'm trying to duplicate, in AB, the following:

http://www.investopedia.com/ask/answers/06/geometricmean.asp

I found some code in the group, but it looks a bit funny to me:

Period = Param("Period",1,1,100,1);
lnGMA = (1/Period)*Sum(ln(C),Period);
Plot(exp(lnGMA),"GMA",1,5);

Or, put more simply:

GMA = exp((1/Period)*Sum(ln(C),Period));

Does that look right to anyone?  I'm just find it hard to verify the numbers 
inside AB....

Any help appreciated!

Reply via email to