Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Onrender for all days loaded

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

    Onrender for all days loaded

    Hello, I am building an indicator that draws a horizontal line at the bottom of the screen to highlight a specific 30 minute period of time.

    my question is, how do I make it render not just on the current day but, for every day loaded. Or at least say the last 10 days.

    I look forward to the help, let me know if there is any other information that is needed.

    cheers!

    beach trader

    #2
    Hello beach trader,

    When using Draw.HorizontalLine() this will draw across the entire chart.


    If you want to draw a line over 10 days, you would need to use Draw.Line() and provide the barsAgo value for the starting point and the barsAgo for the ending point.



    However, you have mentioned OnRender() in the subject, which might imply you are custom rendering a line with RenderTarget.DrawLine().


    The rendered line should be rendered when the starting bar and ending bar are within or overlapping the ChartBars.FromIndex and ChartBars.ToIndex.
    If the starting bar is less than the ChartBars.FromIndex and the end bar is greater than ChartBars.ToIndex, some of the line would be rendered, and the x value of the vector2 of the start point would be 0 (the left of the chart).
    If the starting bar is greater than ChartBars.FromIndex and is less than ChartBars.ToIndex, some of the line would be rendered but would use the x value of the corresponding bar.
    If the ending bar is less than ChartBars.ToIndex the x value of the vector2 for the end point would be the corresponding bar, if the ending bar is greater than ChartBars.ToIndex the x value of the vector2 would be set to the width of the chart.

    Below is a link to an example of a custom rendered scrollable line.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you NinjaTrader_ChelseaB, I will put the scrollable line to use perhaps on another project.

      I am using onrender() to draw my line and using getxbytime for my co-ordinates.

      my problem is it only draws on the current day, how do I get it to draw for all days loaded?

      Comment


        #4
        Hello BeachTrader11807,

        This would be based on the bar number you've chosen as the start point.

        Is the start bar from a previous day?
        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
        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