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
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 algospoke, 04-17-2024, 06:40 PM
|
6 responses
49 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
||
Started by arvidvanstaey, Today, 02:19 PM
|
4 responses
11 views
0 likes
|
Last Post Today, 04:08 PM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
16 responses
61 views
0 likes
|
Last Post
by samish18
Today, 03:30 PM
|
||
Started by jordanq2, Today, 03:10 PM
|
2 responses
9 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
21 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
Comment