Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting a Rectangle in indicator panel

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

    Plotting a Rectangle in indicator panel

    Hi guys, is it possible to "Plot" not "Draw" a rectangle? I know how to make an indicator Draw a rectangle, I'm wondering if there's a way to use a plot. If not, is there an alternative? example: I want to add all the volume within a small number of bars, and have that number be shown as a Box/Rectangle on the indicator panel. I want it updated as a Plot would be updated.

    #2
    Hello ginx10k ,

    Just to get a better idea of what you want, from what I gather it sounds like you want to make boxes horizontally that contain a number(text)?

    A plot specifically won't be able to draw anything other than the default plot styles like bar or line but you can certainly use plots to store data for custom rendering.

    If what I described above is what you are trying to do then using OnRender would likely be the best suggestion. That could be used to draw custom rectangles with text or whatever you wanted.

    If you can provide a little more detail here I can likely point out some existing resources to look into.

    I look forward to being of further assistance.

    Comment


      #3
      Ok. so I want to Add the volume of the last 5 bars, and put that into a Plot, let's call it, volBoxPlot[0]. Volume[1] + Volume[2] + etc...... = volBoxPlot[0]. Then I want like a Box type drawing to be created based on that volBoxPlot[0]. I know that I can plot bars and Lines, but would like for it to look like a box starting let's say 5 bars ago till Currentbar, with startY = 0; endY = volBoxPlot[0].

      Is this "OnRender" able to do something like that? or do you have another suggestion?

      I'm just learning how to program in Ninja Trader 8, so please bare with me.

      Comment


        #4
        Hello ginx10k,

        Thanks for the clarification

        Yes that would be a good use case for OnRender. While that could be accomplished with drawing objects it would be slow.

        More complex plotting is generally achieved by using a plot to store your data and then OnRender to display the data only for the currently visible bars. The pivots and zig zag use this technique.

        Plots are hidden by default when using the OnRender override, you can also have them displayed if you call the base.OnRender() method. https://ninjatrader.com/support/help...htsub=onrender

        The following page has a very simple example of how you would access data from OnRender, this would apply to plots or any Series based data. https://ninjatrader.com/support/help...ghtsub=toindex
        This loops from the visible left bar to the right bar and gets the value.

        To draw rectangles would require a loop like the help guide shows and some logic to control what X/Y you draw the rectangle. Before getting into that I would suggest looking at the SampleCustomRender indicator for some examples of how to draw rectangles or other items using OnRender.

        When you have a better feel for how the X/Y bar/price conversions work you could use the series based volBoxPlot[0] data to convert to y values if needed and you could use the current index in the loop to know where in time you are for drawing a rectangle X.

        The scale for the indicator can be controlled by using OnCalculateMinMax, this would be how you could make a 0 to volBoxPlot value for the scale: https://ninjatrader.com/support/help...ub=oncalculate

        I look forward to being of further assistance.

        Comment


          #5
          Thanks Jesse, I'll look into all of this. much appreciated.

          Comment

          Latest Posts

          Collapse

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