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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
156 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
140 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment