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

OnBarUpdate skipped when no data arrives

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

    OnBarUpdate skipped when no data arrives

    Hi

    I'm aware of the design constrains that led to the problem with OnBarUpdate() only firing when a tick arrives within that bar.
    But it's very limitative, as you may agree. I can't, for example, force a position at a specific time of day and be sure it will be posted exactly at that time. Or I may depend on indicators whose value changes even when no new data is present. Here's a good example:
    An EMA's natural behavior is to naturally decay towards the last bar's value when no data arrives. This decay could trigger a position, for example.
    Another good example would be a strategy that depended on external data (a thread launched on Initialize() that regularly retrieves data from the internet and makes it available to be consumed by the next OnBarUpdate()).

    Is there in the works any fix/workaround to this problem?

    Thanks!

    Sergio

    #2
    NT 6.5 due out in beta late this week supports other event driven methods in addition to OnBarUpdate() such as OnPositionUpdate(), OnOrderUpdate(), OnMarketData() etc.... You can also trigger off of user defined events such as a windows timer object.
    RayNinjaTrader Customer Service

    Comment


      #3
      That's SO neat! Will I be able to place / cancel orders even during those events, I mean, outside an OnBarUpdate call?
      On the same note, will I be able to place orders on different instruments than the one being triggered?

      thanks for your time

      Comment


        #4
        Yes to all questions.
        RayNinjaTrader Customer Service

        Comment


          #5
          Hi, I've been trying to use a timer with 6.5 beta, as described in your post below.
          The 1st problem I notice is that I have no way to know whether the strategy is still running or not in order to disable the timer.
          Is there a flag, an event or some overridable method that I can use to check if the strategy is still running?

          TIA!

          Comment


            #6
            See the Dipsose() method.

            RayNinjaTrader Customer Service

            Comment


              #7
              That worked like a charm. Thanks Ray!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by martin70, 03-24-2023, 04:58 AM
              15 responses
              114 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by The_Sec, Today, 02:29 PM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by jeronymite, 04-12-2024, 04:26 PM
              2 responses
              30 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by Mindset, 05-06-2023, 09:03 PM
              10 responses
              265 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by michi08, 10-05-2018, 09:31 AM
              5 responses
              743 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X