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

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 algospoke, 04-17-2024, 06:40 PM
          3 responses
          26 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by bmartz, 03-12-2024, 06:12 AM
          3 responses
          30 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          2 responses
          10 views
          0 likes
          Last Post Aviram Y  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X