B
Bill Cunningham
I have been trying to construct a function called Ema and have come to
as far as I know what to do with it. According to this page with the numbers
120 and 136 the ema should be 120.16
http://www.pandacash.com/technical-analysis/moving-average/exponential.htm
Here's my source code.
double Ema(double today, double yest, int per)
{
double exp = 2 / (per+1);
double ema = today * exp + (yest * (1 - exp));
return ema;
}
I add 1 to get the exp. Since exp is the same on each end of the
equations except for (1-exp) on the right term I just can't see the bug. I
have come as close as 120.
Bill
as far as I know what to do with it. According to this page with the numbers
120 and 136 the ema should be 120.16
http://www.pandacash.com/technical-analysis/moving-average/exponential.htm
Here's my source code.
double Ema(double today, double yest, int per)
{
double exp = 2 / (per+1);
double ema = today * exp + (yest * (1 - exp));
return ema;
}
I add 1 to get the exp. Since exp is the same on each end of the
equations except for (1-exp) on the right term I just can't see the bug. I
have come as close as 120.
Bill