View Full Version : MAMA Indicator incorrect
Gumphrie
08-18-2007, 11:16 AM
Anyone using this system indicator note that it is doing the calculation incorrectly. Line 110 which reads :
if (im[0] != 0.0 && re[0] != 0.0) period.Set(360 / System.Math.Atan(im[0]/re[0]));
Should be :
if (im[0] != 0.0 && re[0] != 0.0) period.Set(360 / ((180/Math.PI)*System.Math.Atan(im[0]/re[0])));
Basically John Ehlers meant for it to use degrees rather than tangents. Thanks to Mike Winfrey for pointing this out.
NinjaTrader_Dierk
08-19-2007, 04:14 AM
We'll look into and let you know.
NinjaTrader_Dierk
08-19-2007, 05:28 AM
Due to some Adobe Acrobat trouble, I'm unable to read the original article of Dec 2000 from your S&C CD.
Could you please PM me some links or even the article itself (if feasible) to "dierk AT ninjatrader DOT com"?
Thanks in advance
NinjaTrader_Dierk
08-21-2007, 03:27 AM
The MAMA will be fixed with next release. Thanks for pointing out this issue.
Big D
01-10-2008, 12:06 PM
Dierk,
Has the MAMA been fixed in 6.5? I don't believe it has. I wrote my own version of MAMA with the proper radians to degrees fix (ie 180/3.14159) and it does not match the MAMA in 6.5. When I remove the radian to degrees fix, my values match your values.
Derek
Big D
01-10-2008, 12:13 PM
Here's an excel sample (zipped) from TA-Lib.org, so you can compare your steps with theirs. Also, there are 2 lines that need radian to degrees conversions, not just one.
NinjaTrader_Dierk
01-10-2008, 12:18 PM
We'll look into and let you know. Thanks
NinjaTrader_Christian
01-11-2008, 07:01 AM
Hi Big D !
Yes, the MAMA issue should be fixed on the NT6.5.
First let's confirm we are on the same boat:
In <user>\My Documents\NinjaTrader 6.5\bin\Custom\Indicator, in the file @MAMA.cs,
i have 2 lines, with "(180 / Math.PI) *" in it, line 109, and line 119.
Can you confirm this ?
If not, can you please send me 'our' version of the @MAMA, and 'your' (fixed) version (if you don't mind) to: christian AT ninjatrader DOT com.
Thanks,
Christian
Big D
01-11-2008, 12:44 PM
Christian,
My fault, I was looking at the 6.0 version. The 6.5 is doing the correct radian to degrees conversion.
1) However, I didn't notice this before, but on line 104:
im.Set(i2[0] * q2[1] + q2[0] * i2[1]);
should be: im.Set(i2[0] * q2[1] - q2[0] * i2[1]);
The "plus" should be a "minus".
2) This is not a big deal, but on line 117, the smoothPeriod isn't used anywhere in the algorithm, so can be deleted.
3) Where did you get line 126 from:
if (alpha > fastLimit) alpha = fastLimit;
I didn't notice this from the Ehler's or TA-lib.org sites. I'm not saying it's wrong, I just didn't see it on any official sites.
BigD
NinjaTrader_Christian
01-14-2008, 01:05 AM
Hi Big D !
Ok, great that it's ok.
1) & 3) Do you have any reference (reference document or web link) for this ?
Kind regards,
Christian
Big D
01-14-2008, 10:08 AM
This is Ehlers official site:
http://www.mesasoftware.com/technicalpapers.htm
Download the MAMA document.
NinjaTrader_Christian
01-15-2008, 06:19 AM
Hi Big D !
I checked and you seem to be right in all of your 3 items. Kudos to you !
Amended version of the @MAMA indicator will be available in the next beta of NT6.5.
Kind regards,
Christian
badasan
07-05-2009, 06:34 PM
Ninja staff,
There is an error on MAMA code. I double checked with John Ehlers himself. Please check http://www.mesasoftware.com/technicalpapers.htm
and take a look at MAMA.
// Phasor addition for 3 bar averaging}
i2.Set(i1[0] + jQ);
q2.Set(q1[0] + jI);
It should be i2.Set(i1[0] - jQ);
Thanks
NinjaTrader_Dierk
07-05-2009, 10:23 PM
We'll look into and let you know.
NinjaTrader_Josh
07-06-2009, 08:21 AM
Thank you for bringing this to our attention. We will address it in a later version.