Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Please help, MACD Signals.

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

    Please help, MACD Signals.

    Hello,

    I would like a strategy that does BUY / SELLS on MACD Crossovers with a trailing stop.

    I have got a chart up, and plotted the MACD indicator.

    However I cannot get it to work in the Strategy Builder, I do not have a clue what to put in the User Defined Inputs, and can get MACD's in the Conditions box, but not sure if it is correct.

    Basically please may I have some detailed instructions on how to get this working.

    Once it is all up and running, I think that tweaking the values should be easy, I just cannot get it going in the first place.


    Thanks

    #2
    monkey180, if you haven't done so already please check through this documentation of the wizard interface and the conditions builder : http://www.ninjatrader.com/support/h...rd_screens.htm



    We also have a strategy development webinar covering the wizard next Tuesday Sep 6th - http://www.ninjatrader.com/webinars

    I'll have our NinjaScript trainee take a look later as well into your request.

    Comment


      #3
      Hi there.

      Yes please, a defined answer, I have read the guides and are still stuck. Just want to know for making that strategy:

      1. What does in the User Defined Inputs.
      2. What goes in the conditions and actions.

      I understand the general idea of the builder, but do not know where to start specifically with the inputs.

      Thanks
      Last edited by monkey180; 08-31-2011, 03:29 AM.

      Comment


        #4
        I am happy to assist you.

        Hello,

        I am happy to assist you.

        For a MACD crossover strategy, if you want to optimize the periods you will need to set some user defined inputs for the periods of the MACD. I.e. make 3 inputs titled Fast, Slow, and Smooth then set their defaults. Other inputs could be for custom calculations, or to keep track of PnL if your strategy needs to keep track of something like that. You will also want to add some constant value set to 0 so you can test whether the MACD crossed above/below the 0 line.

        Now, you will also want an order size, a stop-loss, and a take-profit user defined input set up eventually before you use this for live trading. These will be used in order management.

        Click image for larger version

Name:	VariablesMACD.PNG
Views:	1
Size:	34.9 KB
ID:	862462

        Next, you need to setup the logic portion. Here you just create rules for when to enter/exit a trade. Each "Set _" tab is a new rule set. For the first "rule" you will select "add" in the section "When the following conditions are true: ". These are the conditions that must occur before the rule/s in the section "Do the following" is applied. In your case, when the "add" window pops up you will select indicators > MACD in the left panel, then set its periods to the user defined inputs, then select crosses above/below in the center, then what it crosses above/below in the right panel (in your case the 0 line).

        Click image for larger version

Name:	ConditionMACD.PNG
Views:	1
Size:	50.3 KB
ID:	862463

        Next you select "add" in the "Do the following:" section and add a rule for whatever you want the strategy to do when the MACD crosses 0. For example, if you chose "crossabove" in the former section, select "Enter long" now, and set the order size to your custom defined variable.

        Click image for larger version

Name:	OrderMACD.PNG
Views:	1
Size:	58.1 KB
ID:	862464

        What you should have after these steps is something like what is below.

        Click image for larger version

Name:	FinalMACD.PNG
Views:	1
Size:	31.4 KB
ID:	862465

        There are a couple things to think about when making a crossover strategy.

        1. Do you want to close an open order if the MACD crosses the opposing way?

        a) If not, then you need to think about other closing criteria.

        2. What stop-loss and take-profit do you want?

        3. How much of your account are you willing to risk on 1 trade?

        Strategies can get quite complicated in the logic they need to operate to not lose you money, so I would recommend learning how to implement them for at least a few months before you even try to use them live. You will ALWAYS want a stop-loss in place. As always, you need to be aware that there are inherent risks associated with live trading as well as automated trading.

        It is difficult to explain everything from scratch, and as such I would strongly recommend you to read the help guide, and to view several videos on the subject of constructing strategies with the strategy wizard.

        Help Guide : (Select Operations > Strategy Wizard)

        Video Library : (Select Operations > Strategy Wizard)

        Webinars : (Look for Automated Strategy Development Webinar times)

        We have a great webinar covering similar material that I have covered in this post on 9/06 @ 5:30 PM EDT.

        Let me know if I can assist further.
        Last edited by NinjaTrader_AdamP; 08-31-2011, 08:35 AM.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          Hi there,

          Thanks for the detailed reply, much appreciated.

          For the MACD Crossover, it is when the Lines Cross, and not when crossing the 0 Line:
          Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.


          Sorry to be annoying, but could you amend and instructions and screen shots in light of this. Thanks

          For example if there is a stop loss of 10, and a limit of 10, and none of these are hit before the next crossover, AT the next crossover would like to cancel the current open order, and replace it with the corrosponding opposite order.


          For example,

          A crossover happens, and it goes long, the profit is +10, and hits the limit of +10, then the order is exited, BUT if an order is exited because it hits a stop, it does NOT open an opposite trade then, BUT waits for the next crossover.

          Lets pretend that I would want this on the FTSE 100, I would want a 10 point stop loss with a 10 point limit.


          Thanks
          [IMG]file:///C:/Documents%20and%20Settings/Ahh/My%20Documents/My%20Pictures/EXAMPLEW.JPG[/IMG]

          Comment


            #6
            I am happy to assist you.

            Of course, and don't worry you aren't annoying me. It is our goal at NinjaTrader to offer a superior standard of support.

            So you want to enter when the MACD lines crosses above/below the MACD average line?

            The procedure is very similar, however now you no longer need a zero-line variable. Your variables should look like the following.

            Click image for larger version

Name:	VariablesMACD2.PNG
Views:	1
Size:	35.3 KB
ID:	862468

            Now you want to setup your buys similar to this :

            Click image for larger version

Name:	Step1_SetupBuy.png
Views:	1
Size:	104.3 KB
ID:	862470

            Then, you want to setup your sells similar to this :

            Click image for larger version

Name:	Step2_SetupSell.png
Views:	1
Size:	105.0 KB
ID:	862471

            Next, you will want to setup your take-profit and stop-loss :

            Click image for larger version

Name:	Step3_SetupTPandSL.png
Views:	1
Size:	194.2 KB
ID:	862469

            Then click "compile"! Let me know if there are errors.

            It is important to note the following :

            "Entry Signal" is a string of text that identifies an order or action. If you want to close an order linked to whatever the entry signal is, you must set the "From entry signal" to the same name as "Entry signal".

            For example, if we enter a long with the "Entry Signal" = MACDLONG, then whenever you reference closing a long, you must put "From Entry Signal" = MACDLONG.

            Please let me know if I can assist further.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Hi there,

              Thanks,



              I was wondering in the "Do the Following" Box, how do I get that "MACDLONG" or "MACDSHORT" Text, because I think that it affects the stop losses.


              Also what is a tick, if we take the NASDAQ 100 E Mini For example, is a tick a point?

              I would want adjust my stops and limits, with points value like on indercies.


              Thanks
              Last edited by monkey180; 09-01-2011, 04:44 AM.

              Comment


                #8
                It is okay, I have solved it.

                How do I copy a strategy?

                Comment


                  #9
                  Can you clarify why you want to copy the strategy? Are you wanting to use these same conditions and events into another strategy? Or are you wanting to run more than one copy of this same strategy?
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Hi there,

                    Yes sort of, how would I open 2 positions at the same time (when a crossover happens), both with different stop loss and order size, on the same instrument?

                    And also yes, If I simply want to copy that strategy, call it a different name, and use it on another instrument.


                    Thanks for you help.

                    Comment


                      #11
                      monkey180,

                      If you wanted to open 2 positions when the condition is met, you would need to create a new Buy or Sell order with a different entry signal name.

                      So where the signal is true and you configured the 'Do the following' and have EnterShort with the signal name MACDSHORT, you would create that again and call it MACDSHORT2 for example.

                      You do not need to copy the strategy and rename it to run it on another instrument. When setting up the strategy you have the option to change the instrument it is running on.
                      MatthewNinjaTrader Product Management

                      Comment


                        #12
                        Hi there,

                        The strategy works well for 1-min chart. What if I want to have a second confirmation signal from a 5-min chart with similar condition? Say MACD is above or below Avg? How can this be added in Strategy Wizard? Much thanks.

                        Comment


                          #13
                          zhawenx,

                          Unfortunately there is no way to do this without custom programming.

                          Please see the following link : http://www.ninjatrader.com/support/h...nstruments.htm

                          Please let me know if I may assist further.
                          Adam P.NinjaTrader Customer Service

                          Comment


                            #14
                            I am pretty sure there exist Ninjascripts for this sort of strategies. I am only interested in MACD. I found one MTF with SMA, but it does not help. MACD is more complicated and you need to define Fast, Slow, Smooth and Avg, etc. I am just not good at playing with the coding. Does anyone know where to find a MTF MACD Ninjascript that I may learn something from? Would appreciate any help.

                            Comment


                              #15
                              zhawenx,

                              Im sure something like this exists in our forum.

                              Here is a link to some educational resources on programming in NinjaScript.



                              Please let me know if I may assist further.
                              Adam P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              668 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              377 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              110 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              575 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              580 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X