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 gravdigaz6, Today, 11:40 PM
|
1 response
7 views
0 likes
|
Last Post Today, 11:49 PM | ||
Started by MarianApalaghiei, Today, 10:49 PM
|
3 responses
10 views
0 likes
|
Last Post Today, 11:33 PM | ||
Started by XXtrader, Today, 11:30 PM
|
0 responses
4 views
0 likes
|
Last Post
by XXtrader
Today, 11:30 PM
|
||
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
9 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
Comment