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

color macd from average tick up/down

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

    color macd from average tick up/down

    i am using the macd with the "macd" plot as the histogram, the "average" as a line, & the "difference", which is normally the histogram, made transparent as i am not interested in it.
    i would like to color the "macd" histogram according to the slope of the "average" depending on whether it ticks up or down.
    i downloaded "macd color background" & "macd up down" from the forum & mucked around a bit...in "macd up down", i inserted :
    if
    (Avg[0] > Avg[1])
    {
    BackColor = Color.PaleGreen;
    }
    else if (Avg[0] < Avg[1])
    {
    BackColor = Color.Pink;
    }
    which changes the background color ok, but i can't seem to work out how to translate this to change the macd histogram color instead.
    pretty new at ninjascript & a bit confused. thanks for any help.

    #2
    upsndowns, you would need to work this sample's concepts into your indicator for coloring the histogram plots on your conditions -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      sorry bertrand but i'm struggling here. with a single indicator having macd & signal line, i just can't figure out the code to link the rise & fall of the signal line to color the macd, which has its own calculations.
      basing my experiments on the macdupdown from the forum, i seem to get errors at the mere mention of macd in my attempts

      Comment


        #4
        Look at the file sharing section for examples of how to do this in a histogram.

        Comment


          #5
          upsndowns, if you post the code you have now we can take a look and see where you run into issues, thanks.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            bertrand, tried posting code by copy/paste but got error message that there was to much text. whats the secret as other posts seem to have tonnes of code in a window?

            Comment


              #7
              Please try posting it with the code tags, or send me an email to support at ninjatrader dot com Attn Bertrand, thanks.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Hello Bertrand,
                Having trouble with 4th part of macd coloring bar code. I am trying to do this: Color bars blue when above 0 level AND macd is above avg otherwise if above 0 and Avg is above macd then color bars black.
                If below 0 then red when macd is below avg otherwise if below 0 and macd is above AVG then black...here is what I have - but it doesnt plot black when above 0 and avg is above macd:
                if (Value[0] >= 0)
                BarColor = Color.Blue;
                else
                if
                ((Value[0] < 0) && (Value[0] < Avg[0]))
                BarColor = Color.Red;
                else
                BarColor = Color.Black;

                I can try and upload an image of what I have if needed

                Thanks for any help - :-)

                Comment


                  #9
                  bert1, I would suggest adding another separate condition for when the barcolor should be changed to black.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    upsndowns,

                    see attached...took 5 minutes.

                    also here:
                    Attached Files
                    Last edited by mountainclimber; 03-18-2010, 12:03 PM.

                    Comment


                      #11
                      bert1,

                      give me a shout if you haven't figured it out yet and I'll take a look at it.

                      Comment


                        #12
                        Thanks guys I'll check this. I have it set for up and down colors blue up red down but the black sideways only was working in upper region - I'll check this out and re-post.

                        Thanks Again
                        Bert

                        Comment


                          #13
                          Thanks again, I kept at it and changed the way I imputed the info and WALA! Code is below and just add it on lines 80-87 of MACDColorBars for indicator as described - THX!

                          if (Value[0] >= 0)
                          BarColor = Color.Blue;
                          if ((Value[0] >= 0) && (Value[0] < Avg[0]))
                          BarColor = Color.Black;
                          if (Value[0] < 0)
                          BarColor = Color.Red;
                          if ((Value[0] <= 0) && (Value[0] > Avg[0]))
                          BarColor = Color.Black;

                          Comment


                            #14
                            Good job, you did it!

                            Comment


                              #15
                              bertrand & mountainclimber, thanks a heap for your help.
                              mountainclimber...brilliant! i saw your posted indicator macd avgupdown in the forum & its exactly what i want.
                              only problem is, i have nt 6.5.1000.14 live (fully paid) & it seems to be uncompatable when importing. so near yet so far !

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              4 responses
                              18 views
                              0 likes
                              Last Post trilliantrader  
                              Started by mgco4you, Today, 09:46 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by wzgy0920, Today, 09:53 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post wzgy0920  
                              Started by Rapine Heihei, Today, 08:19 PM
                              1 response
                              10 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by Rapine Heihei, Today, 08:25 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post Rapine Heihei  
                              Working...
                              X