Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Price panel histogram

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

    Price panel histogram

    Ok, so what I'm looking to do is plot a histogram between two moving averages or similar objects. The problem is the bars always extend up from zero instead of the lower object. Is this even possible in C# or Ninja Script?
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    #2
    you have to override plot method

    or simply use something like DrawLine() between plot1[0] and plot2[0]


    plot1.Set(EMA(Close, 8));
    plot2.Set(EMA(Close, 21));

    Color histo = (plot1[0] > plot2[0] ? Color.Green : Color.Red);
    int width = 2
    DrawLine(CurrentBar.ToString(), 0, plot1[0], 0, plot2[0], histo, DashStyle.Solid, width);

    Hope it helps
    Last edited by roonius; 01-08-2009, 08:45 PM.

    Comment


      #3
      Hi eDanny,

      You can also take a look at DrawRegion() for your task - http://www.ninjatrader-support.com/H...rawRegion.html

      Comment


        #4
        Thanks roonius but I think that is more line objects than I would want on a chart. And Bertrand, a shaded background isn't what I was looking for. I would like to be able to change colors of each histo bar according to other conditions, not just because one MA is over another.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          Hi eDanny,
          Ok, how about adding a new Plot (PlotStyle.Bars) and set this to the higher MA value? You could then color this according to your conditions.

          Comment


            #6
            That is the problem, using bars plots a histogram from zero all they way up to the MA. Nasty! There is no way to make the bottom at the lower MA, or any value other than zero.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              eDanny,

              All three available options have already been discussed in this thread. You need to evaluate and pick one or the other. Using plots or using Draw() have their downsides. If you are unhappy with them only thing you can do is just override the Plot() method. That would require advanced C# that we cannot offer support for if you decide to go down that route.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Took me five minutes to whip one up using DrawLine but like I said it really uses alot more resources. Could we add this to the wish list for NT7?
                eDanny
                NinjaTrader Ecosystem Vendor - Integrity Traders

                Comment


                  #9
                  Thank you for your suggestion. I will add it to the list of future considerations.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Resource question. Does DrawRegion() use less resources than DrawLine() in the above scenario? They both draw something each bar so does the region drawn each bar act the same as a line, only fatter?
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment


                      #11
                      Originally posted by eDanny View Post
                      Resource question. Does DrawRegion() use less resources than DrawLine() in the above scenario? They both draw something each bar so does the region drawn each bar act the same as a line, only fatter?
                      I think DrawLine() would be more efficient method but can't confirm at this time.
                      RayNinjaTrader Customer Service

                      Comment


                        #12
                        Ray, thanks. If you can find out, please, let me know so I can use the best method.
                        eDanny
                        NinjaTrader Ecosystem Vendor - Integrity Traders

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        607 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        353 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        105 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        560 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        561 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X