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

Event queue execution order

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

    Event queue execution order

    Hi there,

    I've got a problem with the execution order of the event queue. I've developed a volume profile indicator which works on tick base (with tick replay). To determine if the bar has finished, I have to use the OnMarketData and the OnBarUpdate event.

    In a second indicator I'm using the volume profile indicator as data source. Unfortunately, the OnBarUpdate event handler of the main indicator is raised before the event handler of the referenced volume profile indicator. Therefor I get empty data for that actual bar.

    Is there a way to control the order of execution?

    BR
    Jan

    #2
    Hello Jan,

    There is not a way to change the order of OnBarUpdate and OnMarketUpdate.

    However, can the script be changed to only rely on market update events and not OnBarUpdate?

    TickReplay might need to be enabled.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      I'm already using both OnBarUpdate and OnMarketData event in the underlying indicator. I also don't want to change the order of these events. I want to control the execution order on indicator level.

      Indicator A has
      • OnMarketData
      • OnBarUpdate
      Indicator B has
      • OnMarketData

      Indicator B is using an instance of Indicator A and is accessing its data. For performance reasons I calculate the volume profile (POC,VAH,VAL) only when the bar has finished (OnBarUpdate). Unfortunately, the OnBarUpdate event of the hosting Indicator B is called before Indicator A. Therefor the volume profile has not been calculated yet and Indicator A gets empty data.

      In my opinion, if an indicator is part of another one, their events should be processed first and in the end events of the main indicator should be called.

      What do you think? Is the problem clear?

      BR
      Jan

      Comment


        #4
        Hello Jan,

        If these are being saved in a series, these would be updated at the same time as OnBarUpdate in the host script.

        If these are not series, you may need to call <Indicator>.Update().
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by funk10101, Today, 09:43 PM
        0 responses
        2 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        36 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        44 views
        0 likes
        Last Post bill2023  
        Started by yertle, Today, 08:38 AM
        6 responses
        25 views
        0 likes
        Last Post ryjoga
        by ryjoga
         
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        24 views
        0 likes
        Last Post algospoke  
        Working...
        X