Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does OnRender happen only on primary dataseries?

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

    Does OnRender happen only on primary dataseries?

    1) Does OnRender or OnRenderTargetChanged happen only for primary dataseries?

    2) I ask that because in one indicator, in OnRender, i use both Bars... and ChartBars.Bars , and even though i have `if (Bars ==null) return` in the start of OnRender, I still get this error very very rarely:

    index was outside of bounds of array (exception stacktrace shows at Target: `NinjaTrader.Data.Bars get_Bars()` )

    so, is there any posibility, that Bars was set and ChartBars.Bars was null?

    #2
    Hello TazoTodua,

    OnRender() is not connected with any data series. This will trigger even if there is no updates to OnBarUpdate.

    NinjaTrader calls on render if something triggers the ForceRefresh() which could be from a plot updating, a chart style script updating from a bar type script updating, a drawing object updating, touching the chart with the mouse with trigger it.. etc..

    Bars is something that is specific to a data series. For anything specific to data series TriggerCustomEvent needs to be used first so that the bars and the RenderTarget threads are in sync.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ChelseaB, i.e. If i call `CurrentBar` from OnRender, will it be always triggered for Primary Series , if i had `AddDateSeries` in indicator?

      Comment


        #4
        Hello TazoTodua,

        CurrentBar will be the one item that is updated in real-time and will reflect the currently processing bar of the currently processing series that is updating OnBarUpdate().
        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
        590 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        342 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
        555 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X