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
OnBarUpdate
Collapse
X
-
Hi Adam,
Thanks for the prompt reply.
I am creating an indicator that loads a second instrument with a different timeframe. Everything works great on live real time data but if the chart is reloaded and for all previous sessions it looks like the data is exactly one bar off (before) from the charts instrument.
Any thoughts on why?
Thanks,
Dan
Comment
-
Hi Adam,
I have spent some time trying to figure out what is going on and it looks like when the main instrument is loading historical data on the chart it is only calling OnBarUpdate once at the bar close. I am using a 2000 tick chart.
I used the BarsInProgress == 0 and printed every time that OnBarUpdate was called and the times matched the ending times of that bar.
9/5/2012 8:29:59 AM
9/5/2012 8:30:45 AM
9/5/2012 8:32:11 AM
9/5/2012 8:33:58 AM
9/5/2012 8:35:52 AM etc.
This is on the ES so there are lots of ticks going off in between.
Can you explain how the historical data is processed. I assumed that it would call OnBarUpdate for each tick or change.
Thanks,
Dan
Comment
-
Hi Dan, for historical processing it would not matter how CalculateOnBarClose is set - it would be 'true' per default here, as the OnBarUpdate() is called for each completed bar, not for each tick (as it would be in realtime / market replay with the CalculateOnBarClose = false).BertrandNinjaTrader Customer Service
Comment
-
Hi Adam,
I am collecting data from the second intrument on a different time frame and putting it in a dataseries which matches the main instrument. With real time it works great but since the OnBarUpdate is only called at the end of the bar on Historical data the data I collected is put into the bar before when the new bar is created.
I assume the dataseries are added to as each new bar is created. When OnBarUpdate is called for the current bar has the next bar been added to the dataseries? Is there a way to shift the data or an easy way add it to the next bar?
Thanks,
Dan
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ninza33, Today, 09:10 AM
|
1 response
10 views
0 likes
|
Last Post Today, 09:46 AM | ||
Started by goodknight777, Today, 08:43 AM
|
1 response
5 views
0 likes
|
Last Post Today, 09:25 AM | ||
Started by kramnor2001, Yesterday, 02:30 PM
|
3 responses
21 views
0 likes
|
Last Post
by kramnor2001
Today, 09:20 AM
|
||
Started by Padan, Today, 02:02 AM
|
3 responses
11 views
0 likes
|
Last Post Today, 08:54 AM | ||
Started by Tim-c, Today, 08:36 AM
|
1 response
3 views
0 likes
|
Last Post Today, 08:45 AM |
Comment