Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

My first strategy - problem with using MAMA

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

    My first strategy - problem with using MAMA

    Hi,

    I have tried to write my first strategy. The strategy is similar like the example "SampleMaCrossover" but instead of using two moving averages I use the MAMA indicator. Everytime the FAMA line crosses above the MAMA line it should go long. When the MAMA line crosses above the FAMA line it should go short.

    However when i try to compile it I get the following error:
    "No overload for method MAMA takes 1 arguments".

    Here is the part of my code where it tells me the error message:
    Code:
    // Condition set 1
    if (CrossAbove(MAMA(MAMAslow), MAMA(MAMAfast), 1))
        EnterLong();
    else if (CrossAbove(MAMA(MAMAfast), MAMA(MAMAslow), 1))
        EnterShort();

    I know there is something wrong with the syntax. Can somebody tell me how to fix it?


    Here is some more code of the strategy:

    Code:
      private double mAMAfast = 0.5; // Default setting for MAMAfast
            private double mAMAslow = 0.05; // Default setting for MAMAslow
            // User defined variables (add any user defined variables below)
            #endregion
             /// <summary>
            /// This method is used to configure the strategy and is called once before any strategy method is called.
            /// </summary>
            protected override void Initialize()
            {
                CalculateOnBarClose = true;
            }
             /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                // Condition set 1
                if (CrossAbove(MAMA(MAMAslow), MAMA(MAMAfast), 1))
        EnterLong();
                else if (CrossAbove(MAMA(MAMAfast), MAMA(MAMAslow), 1))
        EnterShort();  
            }
      
            #region Properties  
      [Description("MAMA fast indicator")]
            [GridCategory("Parameters")]
            public double MAMAfast
            {
                get { return mAMAfast; }
                set { mAMAfast = Math.Max(0, value); }
            }
             [Description("MAMA slow indicator")]
            [GridCategory("Parameters")]
            public double MAMAslow
            {
                get { return mAMAslow; }
                set { mAMAslow = Math.Max(0, value); }
            }
      
            #endregion
        }
    Kind regards
    Markus

    #2
    Hi Markus, the SMA would only have 1 or 2 inputs, however the MAMA indicator needs 2 or 3 (depending on if you want to pass a custom series to work on or not). Here's all overloads available you could call this indicator with - http://www.ninjatrader.com/support/h...a_adaptive.htm

    So there a Fast and SlowLimit you pass in for any MAMA call, to get the actual FAMA value then to compare for your crossover, just access the plot directly via adding .Fama to you MAMA call.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X