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

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 rocketman7, Today, 02:12 AM
        5 responses
        23 views
        0 likes
        Last Post rocketman7  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        7 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by samish18, 04-17-2024, 08:57 AM
        17 responses
        66 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by briansaul, Today, 05:31 AM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PaulMohn, Today, 03:49 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X