Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MAMA Indicator incorrect

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MAMA Indicator incorrect

    Anyone using this system indicator note that it is doing the calculation incorrectly. Line 110 which reads :

    Code:
    if (im[0] != 0.0 && re[0] != 0.0) period.Set(360 / System.Math.Atan(im[0]/re[0]));
    Should be :

    Code:
    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.

    #2
    We'll look into and let you know.

    Comment


      #3
      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

      Comment


        #4
        The MAMA will be fixed with next release. Thanks for pointing out this issue.

        Comment


          #5
          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

          Comment


            #6
            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.
            Attached Files

            Comment


              #7
              We'll look into and let you know. Thanks

              Comment


                #8
                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
                ChristianSenior Software Developer

                Comment


                  #9
                  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

                  Comment


                    #10
                    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
                    ChristianSenior Software Developer

                    Comment


                      #11
                      This is Ehlers official site:



                      Download the MAMA document.

                      Comment


                        #12
                        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
                        ChristianSenior Software Developer

                        Comment


                          #13
                          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

                          Comment


                            #14
                            We'll look into and let you know.

                            Comment


                              #15
                              Thank you for bringing this to our attention. We will address it in a later version.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GLFX005, Today, 03:23 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post GLFX005
                              by GLFX005
                               
                              Started by XXtrader, Yesterday, 11:30 PM
                              2 responses
                              11 views
                              0 likes
                              Last Post XXtrader  
                              Started by Waxavi, Today, 02:10 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by TradeForge, Today, 02:09 AM
                              0 responses
                              11 views
                              0 likes
                              Last Post TradeForge  
                              Started by Waxavi, Today, 02:00 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Working...
                              X