Does it refer to the BarsArray[BarsInProgress] for the current call to OnBarUpdate()? That is, does BarsArray[BarsInProgress] == Bars? Can I substitute one for the other or do they refer to different objects?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Does Bars refer to current Bars object in OnBarUpdate()?
Collapse
X
-
Does Bars refer to current Bars object in OnBarUpdate()?
What does the Bars property/field refer to?
Does it refer to the BarsArray[BarsInProgress] for the current call to OnBarUpdate()? That is, does BarsArray[BarsInProgress] == Bars? Can I substitute one for the other or do they refer to different objects? -
Bars represents the data that is being processed by your script:
These are used to find the BarsSinceSession, etc
BarsInProgress refers to the current call on OnBarUpdate related to the series that may be added, where BarsInProgress == 0 is the primary data series, and BarsInProgress == 1 would be an added data series.MatthewNinjaTrader Product Management
-
So that's my question, does the Bars property always refer to the primary data series? Or does it refer to the current data series that is being handled by OnBarUpdate()?Originally posted by NinjaTrader_Matthew View Post...where BarsInProgress == 0 is the primary data series, and BarsInProgress == 1 would be an added data series.
Comment
-
The Data Series that is being handled by OnBarUpdate
If you were to check Bars.x in OnBarUpdate, you would get multiple calls for each OBU call.
If you wanted to check for only one OBU call, you would need to check for Bars.x in a BIP filter:
Code:protected override void OnBarUpdate() { // This will be called twice as per each OBU call Print("BIP : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession); // These will be called only when that BIP is called if(BarsInProgress == 0) { Print("BIP 0 : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession); } if(BarsInProgress == 1) { Print("BIP 1 : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession); } }MatthewNinjaTrader Product Management
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
596 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
343 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
556 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
554 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment