Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD Crossover

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

    #16
    what I want is that if this MACD crosses ZeroLagMACD at the same time HMA crosses the HMA with other period then it will create an alarm and then it will the result.If the crosses above then the blue color will plot then if crosses below then red will be added to the plotted blue color.If it is flat then white will also be to the plot.

    Comment


      #17
      luxurious_04,

      In that case then you would not use ==, but instead use &&.

      if (CrossAbove(MACD(Fast,Slow,Smooth),ZeroLagMACD(Fas t ,Slow,Smooth) ,1) && CrossAbove(HMA(Period1),HMA(Period2),1))
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        A very big thanks to you.

        Comment


          #19
          Hello! I am having a similar problem, maybe someone can help.

          When I do:

          Code:
          		if (CrossAbove(macdAvg, 0, 1))
          			{
           			Print("MACD Above 0");
                  	}
          I get an error on the second argument of the CrossAbove, it looks like 0 is not accepted, so how can I check if MACD is above 0?

          Thanks a lot!

          Comment


            #20
            yakito,

            The issue is your first parameter, macdAvg. CrossAbove() is looking for a DataSeries, not a double variable. You need to provide a DataSeries to cross above zero.

            For instance...

            Code:
            if (CrossAbove(MACD(12, 26, 9).Avg, 0, 1))
            {
                 Print("MACD Above 0");
            }
            Josh P.NinjaTrader Customer Service

            Comment


              #21
              Thanks a lot! it is working now.

              One more question, do you now if there is any way I can test the "onbarupdate" actions now that the market is closed?

              Thanks again one more time.

              Comment


                #22
                You could backtest on the charts or Strategy Analyzer, or use the Market Replay feature of NinjaTrader -

                Comment


                  #23
                  need help guys

                  I have made the code to proccess buy and sell, on default RSI i have set 30 and 70......
                  how can i change this to 50 above 50 below instead 30 or 70... here is my broken code yet lool....

                  if (CrossAbove(EMA(5), EMA(12), 1)
                  && RSI(
                  21, 3).Avg[0] > 50) <------ bug 1
                  EnterLong ();
                  {
                  EnterLong(DefaultQuantity,
                  "50");
                  }
                  // Condition set 2
                  if (CrossAbove(EMA(5), EMA(12), 1)
                  && RSI(
                  21, 3).Avg[0] < 50 ) <------ bug 2
                  EnterShort ();
                  {
                  EnterShort(DefaultQuantity,
                  "20");
                  }
                  }

                  by the way compiles just fine, but wont function the right way.
                  hope this is not a funy question lool.
                  THANK YOU....
                  Last edited by XXtrem; 10-28-2010, 09:39 PM.

                  Comment


                    #24
                    Welcome to our forums - according to your code the script would trigger on the 50 level for the RSI - do you perhaps refer to the added RSI indicator for display? You would need to change it's oversold and overbought levels (to 50 as well) to reflect what the strategy is doing.

                    Comment


                      #25
                      Thanks....

                      I do it but keep changing back to 30 / 70 again.... looks like i have to create new rsi1 or custom rsa with my default settings... I will try this method see if its working.



                      Originally posted by NinjaTrader_Bertrand View Post
                      Welcome to our forums - according to your code the script would trigger on the 50 level for the RSI - do you perhaps refer to the added RSI indicator for display? You would need to change it's oversold and overbought levels (to 50 as well) to reflect what the strategy is doing.

                      Comment


                        #26
                        Please note that after you make code changes you would need to remove the indicator and add a new instance of it to propagate all changes fully.
                        Josh P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        581 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        338 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        103 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        554 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        552 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X