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

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

    MAMA indicator

    The MAMA indicator plots two lines, a black "Default" line and a blue "Fama" line.

    How would I construct a basic boolean indicator that returns a 1 if the black is above (or crosses above) the blue, otherwise returns a zero? I would like to then test the indicator value in an ATM strategy.

    It appears that the code sets up a data series for the two lines, which the MAMA indicator then plots. I can't seem to access these from a custom indicator or otherwise can't figure out how to structure the C#.
    I started with a copy of the MAMA indicator, but that gets complicated since I would like to plot the binary (1,0) result as a separate line (indicator) in a separate panel.

    Thanks for your guidance on this.

    #2
    Look at the KeyReversalUp indicator source code. This is a concept of plotting 1 if true and 0 if false.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks, Ray...I always appreciate your quick responses.

      Actually, coding the for the 1,0 isn't my main issue. I really can't figure out how to address the data series that are inside the MAMA indicator. Could you please take a quick look at the code and tell me how you would approach the problem?

      Thanks in advance.

      Comment


        #4
        if (CrossAbove(MAMA(double fastLimit,double slowLimit).Fama, MAMA(double fastLimit,double slowLimit), 1)
        // Set some value

        etc...
        RayNinjaTrader Customer Service

        Comment


          #5
          Hi,

          MAMA draws two lines MAMA and FAMA on price by default.

          I would like to plot another value, period, from @MAMA code as a lower
          indicator. So I am not adding anything to the code to calculate new thing.
          Just trying to plot what is already calculated.

          I just added the third line right below two Add command as follows but it doesn't do anything. What did I wrong?

          Add(new Plot(Color.Black, "Default"));
          Add(new Plot(Color.Blue, "FAMA"));
          Add(new Plot(Color.Red, "period")); <==what I added

          Thanks in advance

          Comment


            #6
            Hi badasan,

            One of our in-training support members will respond to your question later today. Thank you for your patience in this matter.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Badasan, thank you for your question.

              Have you assigned a value to the period plot?

              If you take a look at the code for MAMA, you'll see near the bottom two lines:
              Default.Set(...)
              and
              FAMA.Set(...)

              Try adding: period.Set(yourvaluehere) where yourvaluehere is the value you would like to assign to the period plot. You can add a plot without a problem, but it won't display anything until you assign it a value.
              AustinNinjaTrader Customer Service

              Comment


                #8
                Thanks Austin,

                If you look at default MAMA code, there is already period.Set() in the code. Few lines above Default.Set() and Fama.Set().

                I don't know what to do.
                Thanks.

                Comment


                  #9
                  Sorry about that, maybe try naming your plot something else, and then just copy and paste the period.Set() stuff into your new plot. There could be some naming issues going on.

                  Add(new Plot(Color.Red, "myperiod")); <--- add this instead
                  ...
                  myperiod.Set(0.2 * period[0] + 0.8 * period[1]); <--- add this down near the other plot stuff.
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Austin,

                    There are multiple period.Set() depending on multiple "if" clauses,
                    how should I modifiy the code then?

                    Thanks

                    Comment


                      #11
                      I suppose that would depend on what you're trying to do.
                      You could even have a myperiod.Set() for each period.Set() if you wanted to.
                      For example:
                      Code:
                      if (im[0] != 0.0 && re[0] != 0.0)
                                  {
                                      period.Set(360 / ((180 / Math.PI) * System.Math.Atan(im[0] / re[0])));
                                      myperiod.Set(360 / ((180 / Math.PI) * System.Math.Atan(im[0] / re[0])));
                                  }
                      if (period[0] > 1.5  * period[1])
                                  {
                                      period.Set(1.5  * period[1]);
                                      myperiod.Set(1.5 * period[1]);
                                  }
                      AustinNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by badasan View Post
                        Thanks Austin,

                        There are multiple period.Set() depending on multiple "if" clauses,
                        how should I modifiy the code then?

                        Thanks
                        You can't have plots on different panels.
                        If you convert period dataseries to Plot you will have scaling issues.

                        Comment


                          #13
                          Thanks Roonius,

                          You are saying that it is NOT possible to have MAMA and FAMA on price panel and period on lower panel at the same time? Should I then create new indicator for period as a separate lower indicator?

                          Thanks.

                          Comment


                            #14
                            Originally posted by badasan View Post
                            Thanks Roonius,

                            You are saying that it is NOT possible to have MAMA and FAMA on price panel and period on lower panel at the same time? Should I then create new indicator for period as a separate lower indicator?

                            Thanks.
                            Yes. That would be the easiest way.

                            Comment


                              #15
                              Pease help

                              I want to change the value of FAMA line to be the same as SMA 50 (simple moving average 50) line.
                              The default value of MAMA is Fast=0.5 and Slow= 0.05.
                              So what is the new value of MAMA / FAMA will be quite similar to SMA 50 please? Anyone who know well, Please help me.
                              Thanks and best regards,

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post Javierw.ok  
                              Started by timmbbo, Today, 08:59 AM
                              2 responses
                              10 views
                              0 likes
                              Last Post bltdavid  
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              40 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              18 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X