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

Want to apply Swings to a MACD

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

    Want to apply Swings to a MACD

    I want to try to modify the Swing indicator to have it display swings on a MACD indicator.

    Before I attempt this, I want to know:

    1. Is it possible?
    2. Is it relatively simple?

    If its possible, are there any nuances that I should be aware of?

    Thanks for any help anyone can provide.

    Regards,
    taddypole...

    #2
    Hi Taddypole,

    Yes, it is possible. Unfortunately we can't comment on the simplicity. The swing source code is fairly complex so it will depend on your ability to reverse engineer existing source code and resolve any problems that may come up.

    You can see swing source code through Tools > Edit NinjaScript > Indicator > Swing.

    Save a copy through Right Click > Save As > provide a new name.

    You can see where High[0] and Low[0] are used for existing swing points, and these places would need your MACD value.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I added the code for the MACD to the Swing indicator but have a compile error. Using the Macd indicator produces a macd variable of Double. The Swing indicator uses normally a price dataseries (High[0], Low[0]).

      In the lines below, is where i've added the macd Double to the last high and low cache. With that code is where i get the compile error.

      lastHighCache.Add(macd);

      lastLowCache.Add(macd);

      Is there a way to use this double value or do i need to convert the Macd to a dataseries?

      I've attached the SwingMacd test code with the offending lines commented out.

      thanks,
      taddypole...
      Attached Files

      Comment


        #4
        Sorry, I'm not familiar with the exact code changes you would need to make this. I tried a double in this line and did not encounter compile errors:

        lastHighCache.Add(44.5);

        It is possible to chart this without custom programming. Just select MACD as input series for Swing indicator. Attached screenshot showing the result.
        Attached Files
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I think that is what I want Ryan.

          Can you show me how you select Macd as the input to the Swing indicator?

          Comment


            #6
            taddypole,

            Instead of:
            lastHighCache.Add(macd);
            lastLowCache.Add(macd);

            Try:
            lastHighCache.Add(MACD(12, 26, 9)[0]);
            lastLowCache.Add(MACD(12, 26, 9)[0));

            VT

            Comment


              #7
              Here is the configuration for this. Apply MACD first, then Swing. For Swing input series, set to MACD. For panel, assign the number that the MACD is in.
              Attached Files
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Thank you very much Ryan,

                That should get me going on this project...

                have a great weekend...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by hazylizard, Today, 08:38 AM
                4 responses
                10 views
                0 likes
                Last Post hazylizard  
                Started by geddyisodin, Today, 05:20 AM
                2 responses
                18 views
                0 likes
                Last Post geddyisodin  
                Started by Max238, Today, 01:28 AM
                5 responses
                47 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by giulyko00, Yesterday, 12:03 PM
                3 responses
                13 views
                0 likes
                Last Post NinjaTrader_BrandonH  
                Started by habeebft, Today, 07:27 AM
                1 response
                16 views
                0 likes
                Last Post NinjaTrader_ChristopherS  
                Working...
                X