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

MACD UpDown

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

    MACD UpDown

    I am using NT7. I believe there was a 6.5 indicator that plotted the MACD line up green and down red. Can someone show me how to modify the MACD indicator to do this.

    #2
    rtj4201, I believe there's already a script shared for this purpose for NT7 :

    BertrandNinjaTrader Customer Service

    Comment


      #3
      I want the MACD line to be green or red. I don't see that.

      Comment


        #4
        Wouldn't the Jurbol BB MACD do what you seek? If you'd like to custom code a script to change the plot colors of the MACD that would be of course possible as well:

        BertrandNinjaTrader Customer Service

        Comment


          #5
          I would like to custom change MACD so uptick of MACD is green and downtic is red.

          Comment


            #6
            Yes, this would be possible as well as mentioned, you would then need to custom code a script for this task. If you would like to get this coded professionally for you, a NinjaScript consultant would be a good route to take :

            BertrandNinjaTrader Customer Service

            Comment


              #7
              It can't be more than two lines or so. Is that necessary.

              Comment


                #8
                Here's my suggestion rtj4201, I'll ask one of our Ninja-script trainees to create this as a side project - we'll then post here and in the sharing.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hello rtj4201,

                  I have uploaded a modified version of the MACD indicator which plots the MACD line color green when up and red with down.



                  Please let me know if you have any issues or questions.
                  MatthewNinjaTrader Product Management

                  Comment


                    #10
                    Use the PlotColors Method

                    Hi, the Magic you want is in the PlotColors API. Below is a sample of some code you may try.
                    As you may see from the font, I've edited some code I use for something else & haven't tested it specifically for your use here.
                    eg: Using Ticksize makes more sense for MA's & those plotted in the Price chart. For oscillators you'll probably need to adjust to suit.
                    Code:
                    private double FLAT_TOLERANCE; 
                     
                    [FONT=Calibri]FLAT_TOLERANCE = 0.05 * TickSize; // 5% of a Tick[/FONT]
                     
                    [FONT=Calibri]if ( Math.Abs([FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]MACD(Close,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT][/SIZE][/FONT] - [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]MACD(Close,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT][/SIZE][/FONT]) <= FLAT_TOLERANCE) { //Flat[/FONT]
                    [FONT=Calibri] PlotColors[0][0] = colorFlat;[/FONT]
                    [FONT=Calibri]}[/FONT] 
                    [FONT=Calibri]else if ( ([FONT=Courier New][SIZE=2]Close,[COLOR=#800080][COLOR=#800080][COLOR=#800080]12[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]26[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]9[/COLOR][/COLOR][/COLOR])[[COLOR=#800080][COLOR=#800080][COLOR=#800080]1[/COLOR][/COLOR][/COLOR]][/SIZE][/FONT] - [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]MACD(Close,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT][/SIZE][/FONT]) >= FLAT_TOLERANCE ) { //Down[/FONT]
                    [FONT=Calibri] PlotColors[0][0] = colorDown;[/FONT]
                    [FONT=Calibri]}[/FONT] 
                    [FONT=Calibri]else if (([FONT=Courier New][SIZE=2]Close,[COLOR=#800080][COLOR=#800080][COLOR=#800080]12[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]26[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]9[/COLOR][/COLOR][/COLOR])[[COLOR=#800080][COLOR=#800080][COLOR=#800080]0[/COLOR][/COLOR][/COLOR]][/SIZE][/FONT] - [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]MACD(Close,[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]12[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]26[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]9[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]][/SIZE][/FONT][/SIZE][/FONT]) >= FLAT_TOLERANCE ) { //Up[/FONT]
                    [FONT=Calibri] PlotColors[0][0] = colorUp;[/FONT]
                    [FONT=Calibri]}[/FONT]
                    [FONT=Calibri]Plot0.Set([FONT=Courier New][SIZE=2]MACD(Close,[COLOR=#800080][COLOR=#800080][COLOR=#800080]12[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]26[/COLOR][/COLOR][/COLOR],[COLOR=#800080][COLOR=#800080][COLOR=#800080]9[/COLOR][/COLOR][/COLOR])[[COLOR=#800080][COLOR=#800080][COLOR=#800080]0[/COLOR][/COLOR][/COLOR]][/SIZE][/FONT]);[/FONT]
                    Hope this points you in the right direction.

                    Comment


                      #11
                      Thx for input, I will give it a try.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by GwFutures1988, Today, 02:48 PM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Started by ScottWalsh, 04-16-2024, 04:29 PM
                      6 responses
                      30 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by frankthearm, Today, 09:08 AM
                      10 responses
                      36 views
                      0 likes
                      Last Post frankthearm  
                      Started by mmenigma, Today, 02:22 PM
                      1 response
                      3 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by NRITV, Today, 01:15 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post NRITV
                      by NRITV
                       
                      Working...
                      X