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

Newbie MACD Strategy Builder question

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

    Newbie MACD Strategy Builder question

    I'm new to NinjaTrader and I'm trying to use the Strategy Builder to create simple buy and sell signals based off of MACD crossovers.


    What I want is:

    Buy signal = MACD Line: (12-day EMA - 26-day EMA) CROSSES ABOVE the Signal Line: 9-day EMA

    Sell signal = Signal Line: 9-day EMA CROSSES ABOVE the MACD Line: (12-day EMA - 26-day EMA)



    Would extensive coding be required in building this? I have done some very minor code editing before, but not too much. I'm in the conditions category and I think that "crosses above" and "crosses below" will be selected int he middle there. But I'm a bit confused about what to do with the parameters. Also not sure what to do with inputs and variables. I'm a newbie to this platform, so any help would be greatly appreciated. Thanks!

    #2
    Newbie MACD

    Your on the right path. The conditions go in the upper portion of the Set 1 and the buy goes in the lower portion

    In Set 1 select add then indicator then MACD and select the correct parameters in the left panel and under plot select the AVG or MACD then the crossover you want and then in the panel on the right select the perimeters for the other MACD you are using. When that is as you want it go to the lower section and select add then order management then enter l;ong position or the type of entry you want.

    For the sell do the same thing but in a new set.
    you can stops and targets to select those items.

    Hope this helps.

    Comment


      #3
      Thanks!

      Thanks so much for the help! I used your guidance to figure out how to make the MACD strategy execute the way I wanted.

      I had another question. Is there a way to program a buy signal only when the crossover I mentioned occurs above the zero line?
      Last edited by JayKeepsTrading; 02-18-2018, 01:21 PM.

      Comment


        #4
        Hello JayKeepsTrading,

        You can compare the lower of the two indicator values to be greater than a Numeric value in the Misc section of the condition builder and have this set to 0.

        I also wanted to provide a link to a forum post with helpful information about getting started with NinjaScript that includes a link to a video on the Strategy Builder.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Yes, you can what you are asking. Once you have the MACD cross set the way you want you add an additional statement.
          In Strategy Builder, on the Inputs and Variables screen click “Add” under Inputs. Name = MACDfast, Type = Double, Default = 0.5, Min = 0.1 Click OK
          Under Conditions & Actions screen set conditions to “If All” Click Add. In left box select MACD, change Value Plot to “Diff”.
          Set center box to “Greater” or “Greater Equal”.
          In right box select User Input MACDfast. Click OK and Compile.

          To do the opposite use Name = MACDslow, Type = Double, Default = -0.5, Min = -200 (remember -200 is less than -.5)
          Set center box to “Less” or “Less Equal”.
          In right box select User Input MACDslow. Click OK and Compile.

          Frankly I don’t think you will get much in the way of results w/ this strategy. It would be better to use a different Indicator for the first statement (a simple EMA cross for example) and have it confirmed by the second MACD statement.

          Comment


            #6
            It happens because MACD is based on two moving average indicators applied directly on the chart (they are not displayed in the MACD chart, only their readings are used).

            MACD itself is displayed in a separate window under the chart. It looks like a histogram with an auxiliary line. The histogram shows that divergence of two moving averages tutuapp software.
            Last edited by Andrew425; 01-18-2019, 11:00 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rocketman7, Today, 02:12 AM
            5 responses
            23 views
            0 likes
            Last Post rocketman7  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            7 responses
            28 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by samish18, 04-17-2024, 08:57 AM
            17 responses
            66 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by briansaul, Today, 05:31 AM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by PaulMohn, Today, 03:49 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X