Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Last Bar on Chart OnBarUpdate not firing
Collapse
X
-
Last Bar on Chart OnBarUpdate not firing
I have a 2 minute chart for ES futures with CME US INDEX FUTURES RTH session selected. The RTH close is at 1:15 PM PST. I see this OnBarUpdate fire for every day end except the last bar on the chart. Today is 10/25/2020, the last RTH bar is on 10/23/2020 and I only see an OBU 10/23/2020 1:14:00 PM, but not for 10/23/2020 1:15:00. When I load multiple days I can see that the 1:15:00 PM bar is processed (for example 10/22/2020 1:15:00 PM). Is this a bug?Tags: None
-
it is set to Calculate.OnBarClose, I guess I misunderstood what onbarclose meant. My problem is that when i am between sessions (ie: Sunday evening) my indicators are not updating RTH values for Friday volume profiles because the last bar on the chart's OBU is not being called. How would I solve this?
Comment
-
The profiles are based on the bar close and only the last bar on the chart is messed up. I might try to include some logic in State == State.Transition to check , although this would mean that OBU probably gets called again for the previous session's last bar when the next RTH session starts?
Comment
-
Hello habibalex,
You can have logic that runs when a bar closes and a new bar opens by checking IsFirstTickOfBar to be true, and then allow everything else to update in real-time.
Yes, the last bar of session closes as a new session opens and opens a new bar.
The State.Transition is when a strategy has finished processing historical data in State.Historical, and is transitioning to State.Realtime and is getting real-time orders and actions ready.
Chelsea B.NinjaTrader Customer Service
Comment
-
How do I update the last bar on the chart in this variable? using -1 used to work in NT7
Code:dsMSopen = new Series<double>(this, MaximumBarsLookBack.Infinite);
Code:if(State == State.Historical){//once indicator is loaded will not continue to update profiles if(CurrentBar >= Time.Count - 2){//do for last bars int i = -1;//ninja doesn't call OBU for last bar, so update it here try{ dsMSopen[i] = Open[i] + priceoffset; dsMShigh[i] = High[i] + priceoffset; dsMSlow[i] = Low[i] + priceoffset; dsMSclose[i] = Close[i] + priceoffset; //Values[0][i] = Close[i]; if(negative && dsMSopen[i] > 0){ dsMSopen[i] *= -1; dsMShigh[i] *= -1; dsMSlow[i] *= -1; dsMSclose[i] *= -1; //Values[0][i] *= -1; } }catch(Exception ex){} } }
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 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
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment