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

How to tell when historical data has finished processing?

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

    How to tell when historical data has finished processing?

    I have an indicator that loads data from various timeframes and once loaded processes it in OnBarUpdate. This is the initial processing phase. I want to then be able to start the incremental analysis after each bar has finished forming.

    So my question is how can I tell when the last historical bar has finished processing and I am about to start processing realtime data? I believe there is a state variable that gets set when realtime data updates begin. Should I use that ? Secondly, how can I tell when the bar has finished forming as I don't want to call the incremental processing while the tick updates are forming the bar.

    #2
    Hello,

    Thank you for the question.

    Regarding knowing when you are in realtime, you can use State.Realtime to know you are in realtime but this will happen for the first realtime bar and those after. If you want to do something before realtime but after historical that is State.Transition.



    As far as knowing when a bar has formed, NinjaTrader uses the bar close to know this. If you are using Calculate.OnBarClose you can expect that OnBarUpdate will be called for each Closed bar. If you are using Calculate.OnEachTick you can utilize the IsFirstTickOfBar property to know when a new bar starts. This could be used to then find the closed bars price by using [1] for the BarsAgo.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,
      Thanks for the answers to my questions..

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,611 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      9 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      19 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      6 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      22 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X