Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw only before/at/after current bar

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

    Draw only before/at/after current bar

    Hello,

    Is there a straightforward way to get an indicator to only draw something before, at, or after (time axis) wherever the must recent bar is on the chart?

    For example, I have a chart with a right side margin (RSM) of 200 and I'd like to have an indicator draw a rectangle with x-coordinates from RSM + 25 to chartControl.CanvasRight - 25.
    In other words, I'd like the rectangle to start to the left of the RSM/most recent bar by a few bars and then extend to the right just before the chart canvas ends.

    I know how RenderTarget.FillRectangle(newRectangleF(floatx,floaty,floatwidth,floatheight), Brush) works, I just can't figure out how to access RSM via code. I honestly don't even need to use the right side margin if there's another way, I just want the code to be able to locate the x-position of the most recent bar on the chart and then draw a rectangle in that area.

    #2
    Hello Convert,

    With Drawing objects you can use 0 barsAgo to draw on the last bar on the chart.

    When custom rendering in OnRendr(), you can use the x value from the last bar on the chart.



    Or you can read the value of the BarMarginRight from the ChartControl properties.


    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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