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 NRITV, Today, 01:15 PM
      2 responses
      6 views
      0 likes
      Last Post NRITV
      by NRITV
       
      Started by frankthearm, Today, 09:08 AM
      7 responses
      30 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by maybeimnotrader, Yesterday, 05:46 PM
      5 responses
      25 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by quantismo, Yesterday, 05:13 PM
      2 responses
      18 views
      0 likes
      Last Post quantismo  
      Started by adeelshahzad, Today, 03:54 AM
      5 responses
      33 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X