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.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to tell when historical data has finished processing?
Collapse
X
-
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.Tags: None
-
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.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
601 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
559 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
558 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment