Announcement

Collapse
No announcement yet.

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 :

    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:

        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 :

            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.

                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 Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      600 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      346 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      558 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      558 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X