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 algospoke, 04-17-2024, 06:40 PM
      6 responses
      49 views
      0 likes
      Last Post algospoke  
      Started by arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      61 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      10 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      21 views
      0 likes
      Last Post traderqz  
      Working...
      X