• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Building Strategy based on MACD

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

    Building Strategy based on MACD

    Hello everyone. Im making progress building my strategy thanks to all your replies and guidance on my previous posts.

    They all have been really helpful. That's why im making this new post about MACD indicator. I want to add it as a confluence for my strategy. The thing is I don't really know how to access to the elements that are part of the MACD indicator (the lines that cross). I mean, I dont know what to call them on my conditions statements.

    For what I see when I configure the MACD, the lines that cross are the MACD line (fast ema of 12 period) and the Avg line (the slow sma of 26 period) PD: I dont know what the smooth 9period is for.

    Anyways.

    Let me elaborate with this following example:

    //Set 1

    if (fast 12 period crosses above slow 26 period && the cross occurs above the zero line (so-called base line)
    {
    BUY
    }

    //Set 2


    if (fast 12 period crosses below slow 26 period && the cross occurs below the zero line (so-called base line)
    {
    SELL
    }


    What are the names I need to write on my condition statement to reference these MACD elements? For the fast, slow and zero line.

    And actually, Id be perfect to know how to reference the other levels that surround the zero line... for instance:


    if (fast 12 period crosses above slow 26 period && the cross occurs above -1.5 and below 1.5) //-1.5 and 1.5 are the values that are around the zero line.
    {
    BUY
    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    1.50 //the cross must occur below this level


    0 (zero line) //ideal zone


    -1.50 ////the cross must occur above this level




    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Thank you in advance.






    #2
    Hello camtrading,

    Thanks for your post.

    Just to check, you have posted in the NinjaTrader 7 strategy forum.

    If you are using Ninjatrader7, are you coding directly in Ninjascript or are you working with the Strategy Wizard in Ninjatrader7?

    If you are using NT8, I can move this to the correct forum and also would need to know if you are coding directly in Ninjascript, or are you working with the Strategy Builder in NinjaTrader8?

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello again. Im so sorry, my mistake. Please move this to NT8.

      Im coding directly in NinjaScript.

      Comment


        #4
        Hello camtrading,

        Thanks for your reply.

        We've moved the thread to the NinjaTrader 8 forum, no worries.

        An easy way to learn to code is to actually use the Strategy Builder to create the condition you are looking for and then use "view code" to look at the coding created by the Strategy builder. You can then copy and paste what you need and it helps to see the syntax generated. To that end, I've created a short specific video on the MACD questions: https://paul-ninjatrader.tinytake.co...M18xNDEwNDA3OQ

        In addition, here is another example of using the strategy builder to generate code for you: https://paul-ninjatrader.tinytake.co...NV8xMTQ5NjY2NQ

        You can also use the ninjascript section of the help guide to see how to use the MACD as well: https://ninjatrader.com/support/help...gence_macd.htm

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jeronymite, Today, 09:26 PM
        0 responses
        5 views
        0 likes
        Last Post jeronymite  
        Started by ttodua, Yesterday, 06:45 AM
        2 responses
        17 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by franco12364, Today, 08:08 PM
        2 responses
        10 views
        0 likes
        Last Post franco12364  
        Started by smcllr, Today, 06:10 PM
        1 response
        16 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by lupearadu, Today, 01:58 PM
        7 responses
        38 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X