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

EMA Slope Histogram - Help with Color Changes

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

    EMA Slope Histogram - Help with Color Changes

    Hello,
    Could someone please see if they could change the code of this indicator to make the histgram bars change color from green to red. Green if the histogram bar values are increasing and red if the histogarm bar values are decreasing.

    Thanks alot,

    dwalls
    Attached Files

    #2
    I'd like to know how to do that too - without adding extra plot series for each color I want.

    I thought the global variable BarColor sets the color of the current indicator. But it doesn't. BarColor=Color.Green always sets the color of the price bar to green, not my indicator bars.

    I'd like to know how to set the width of an individual bar or point also.
    -Alex

    Comment


      #3
      Hello,

      Please go to: Tools>Edit NinjaScript>Indicator>VolumeUpDown, and look at the code. This default indicator is a good example on how to change the Histogram colors.

      Alex - this in the way you will want to do it: with a second plot.
      Last edited by NinjaTrader_Ben; 08-19-2008, 10:00 AM.
      DenNinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Ben View Post
        This is the way you will want to do it: with a second plot.
        OK, it seems kind of inefficient though. I'd have thought that if each price bar has its own color associated with it, then so too would each bar or point on a custom indicator would have a similar property I could set.

        The same question also applies to bar width.

        Also, that solution doesn't answer the question about how to make a bar plot with variable colors. Suppose for example I wanted to color the bars according to a rainbow spectrum, or temperature spectrum, depending on some calculated value. How would I do this?

        -Alex

        Comment


          #5
          Hello,


          Regarding the bar width you will need to do basically the same thing with a different value included after the color in Pen().

          When you type in: Color.
          ...the editor will show you the available colors you can use. These are you choices.
          DenNinjaTrader Customer Service

          Comment


            #6
            Um, no I don't think so. I'm now having multiple colors and widths with just one plot series. Please tell me, though, which is more efficient, computationally and memory-wise:
            • Establish a plot series for every possible combination of color and line width that I intend to use (the recommended method in this thread).
            • Establish just one plot series with a default color and line width, initialize DrawOnPricePanel=false, and use DrawLine() to paint over the plot with different colors and widths when needed.
            DrawLine() is the workaround I am using now. Is there any disadvantage to doing it that way?

            (The only downside I have observed to doing it my way is, I have to make some colors as input parameters, and all of those color names are displayed on the chart in the indicator title area.)

            Alex

            Comment


              #7
              DrawLine() can be taxing on the charting if you have it on every single bar. To remove the parameter listing from the indicator title please see this sample: http://www.ninjatrader-support.com/v...3814#post23814
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by Josh View Post
                DrawLine() can be taxing on the charting if you have it on every single bar.
                Thanks, I'll keep that in mind. On the indicator I made just now, it's looking like it's calling DrawLine() on less than 10% of the bars, so it's probably OK.
                -Alex

                Comment


                  #9
                  I just noticed something else.
                  Originally posted by NinjaTrader_Ben View Post
                  When you type in: Color.
                  ...the editor will show you the available colors you can use. These are your choices.
                  Um, the choices aren't as limited as you think. One of those choices is Color.FromArgb(), which offers over 16 million colors. If I wanted to have colors based on the result of some calculation, I'd use FromArgb(), and then I'd need a way to have a unique color on each indicator marker. The only way I can think to accomplish this is to use DrawLine() to generate my indicator.

                  It would be less kludgey if each marker had color and width properties that I could set. That would eliminate the need to allocate a huge number of plot series, and also eliminate the need to bog down the charting with thousands of DrawLine() objects.

                  Price bars have individual color properties, but not width. That should be fixed too.
                  -Alex
                  Last edited by anachronist; 08-21-2008, 12:33 AM.

                  Comment


                    #10
                    Thanks for the suggestions. We will put them on the list of future considerations.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Wouldn't something similar to the code in the Help system under 'Plots' do what you want?

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by nandhumca, Today, 03:41 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post nandhumca  
                      Started by The_Sec, Today, 03:37 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post The_Sec
                      by The_Sec
                       
                      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
                      33 views
                      0 likes
                      Last Post ScottWalsh  
                      Started by frankthearm, Today, 09:08 AM
                      10 responses
                      36 views
                      0 likes
                      Last Post frankthearm  
                      Working...
                      X