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

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
      BertrandNinjaTrader Customer Service

      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.
          BertrandNinjaTrader Customer Service

          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 helpwanted, Today, 03:06 AM
                        1 response
                        7 views
                        0 likes
                        Last Post sarafuenonly123  
                        Started by Brevo, Today, 01:45 AM
                        0 responses
                        7 views
                        0 likes
                        Last Post Brevo
                        by Brevo
                         
                        Started by aussugardefender, Today, 01:07 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post aussugardefender  
                        Started by pvincent, 06-23-2022, 12:53 PM
                        14 responses
                        242 views
                        0 likes
                        Last Post Nyman
                        by Nyman
                         
                        Started by TraderG23, 12-08-2023, 07:56 AM
                        9 responses
                        384 views
                        1 like
                        Last Post Gavini
                        by Gavini
                         
                        Working...
                        X