• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Histagram on the bottom of Price Panel

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

    Histagram on the bottom of Price Panel

    Hello folks,

    Using NT 8.0.16.2, 64 bit. Trying to create a histogram on the bottom of price panel on the chart. it consists of small rectangles hovering around Y = 0. Problem is that what I get is - squished bars at the top (around 2900 area) and squished rectangles at the bottom (around 0) as attached. So it looks like two horizontal lines: the chart and the rectangles.

    How can I possibly have it so that nothing is squished (chart is intact and rectangles at the bottom are visible)? In other words how to hide the big chunk of empty space between current market prices and 0? I obviously don't want to use fixed Y=2900 for histogram, cause the price will change with time.

    Currently I use this to draw rectangles:
    Draw.Rectangle(this, "FrDim" + CurrentBar, true /* auto scale */, 0, 0, 1, RectSize, Color, FillColor, 100 /*non transparent */, true /* on price panel */);

    It does not have to be rectangles hovering around Y=0, I just thought it will work, but it seem to not. What is the right way to put an indicator on the bottom of price chart in this case (and not in a separate panel from the chart)?


    Thank you very much in advance!
    Last edited by stasha; 11-19-2018, 08:43 AM.

    #2
    Hello stasha,

    Thanks for your post.

    For this, we would recommend using OnRender(). You can see an example of the coding needed in the indicator SampleCustomRender in your NinjaTrader. The sample indicator also is commented to help clarify the code. Here is a link to OnRender(): https://ninjatrader.com/support/help.../?onrender.htm

    Alternatively, you might consider using a plot with the plot style set to "bar" instead of using Draw.Rectangle and then use the scale justification of "Overlay".
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul.
      I went with 2nd approach: AddPlot and giving it a value with overlay scale works perfect - thank you very much!
      Another follow question is how can I change those plotted bars color on the fly using some calculation?
      Basically:
      if (condition1) Plot[0].Brush = Green;
      else if (condition2) Plot[0].Brush = Red;

      What should be in place of Plot[0].Brush? I found no way of modifying the color of the plot after it is added in AddPlot and am pretty sure there must be one.

      Thank you!

      Comment


        #4
        Hello stasha,

        Thanks for your reply.

        Changing the Plot[0].Brush will change the entire series. What you want to use is PlotBrushes[][] when the first index[] is the plot number and the second index[] is the actual bar to change.

        Please see the help guide for an example conditional use: https://ninjatrader.com/support/help...lotbrushes.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Paul,
          Thank you very much!
          Very prompt and to the point! Wish all companies had this kind of support!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by saeed, Today, 10:17 AM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by ntbone, Yesterday, 08:10 PM
          2 responses
          24 views
          0 likes
          Last Post ntbone
          by ntbone
           
          Started by Bougie_NT8, Today, 08:44 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Tyler  
          Started by pjsmith, Today, 02:56 AM
          6 responses
          14 views
          0 likes
          Last Post pjsmith
          by pjsmith
           
          Started by bubblegum, Today, 01:13 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X