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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
578 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
334 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment