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!
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
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 Perr0Grande, Today, 08:16 PM
|
0 responses
2 views
0 likes
|
Last Post
by Perr0Grande
Today, 08:16 PM
|
||
Started by elderan, Today, 08:03 PM
|
0 responses
5 views
0 likes
|
Last Post
by elderan
Today, 08:03 PM
|
||
Started by algospoke, Today, 06:40 PM
|
0 responses
10 views
0 likes
|
Last Post
by algospoke
Today, 06:40 PM
|
||
Started by maybeimnotrader, Today, 05:46 PM
|
0 responses
12 views
0 likes
|
Last Post Today, 05:46 PM | ||
Started by quantismo, Today, 05:13 PM
|
0 responses
7 views
0 likes
|
Last Post
by quantismo
Today, 05:13 PM
|
Comment