Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
how to know bars are not current
Collapse
X
-
how to know bars are not current
what's the best way to know that the current bar is not an updating bar, such as when you scroll the charts right, the top right of the chart shows a black triangle. I'm thinking of checking bar[0]'s time being way older than the current time, but probably there's a much easier and better way to do it?Tags: None
-
Correct, that's the behavior I want, but I don't know how to write a conditional statement for that.
I need to create a pseudo-code for something like this:
If the black triangle appears, then do this...
If the current-bar becomes hidden, then do this...
If the right-most bar is not a bar that updates in real-time, then do this...
Each of the three statements above satisfies my need, but what would be the easiest way for me to code something like that? I was considering checking the right-most bar's timestamp with conjunction of the time period (time/volume/tick) to know that it is one bar too old to be a current bar, but that seems kind of complicated. Was hoping there is something trivial.
Thanks!
Comment
-
edsfreedom,
Unfortunately this is not the way indicators are calculated. Indicators (and strategies) process from the oldest bar forward. After it finishes calculating it will sit there on the most recent bar and wait for more data to come in for further processing. As you scroll back in time it does not retrigger calculations.
Essentially what this boils down to is that every bar processed and every OnBarUpdate() event is always the most recent bar at the time it is processed.Josh P.NinjaTrader Customer Service
Comment
-
I've found the easy solution from looking at the VolumeProfile indicator code:
if (ChartControl.LastBarPainted < Bars.Count - 1)
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
152 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
305 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
244 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
345 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
176 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment