Using ninjascript, how do I get the bar date when the new daily bar created? Using Times[0][0] will give me the current data datetime (which I can try to check for the timestamp and add 1 day to get the bar date, but it seems like a hack because these start time can be different/change with other instruments), am I right? In futures, the new daily bar created at 18:00 from the current day, but the actual bar date is next day.
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
get the bar date when the new daily bar created
Collapse
X
-
get the bar date when the new daily bar created
Hi,
Using ninjascript, how do I get the bar date when the new daily bar created? Using Times[0][0] will give me the current data datetime (which I can try to check for the timestamp and add 1 day to get the bar date, but it seems like a hack because these start time can be different/change with other instruments), am I right? In futures, the new daily bar created at 18:00 from the current day, but the actual bar date is next day.Last edited by affilife; 02-20-2024, 02:00 PM.Tags: None
-
Hello affilife,
That depends, what is the instrument (so we know the trading hours), what is the time zone, what is the Calculate property set to, and is TickReplay enabled?
Let's say the instrument is the ES 03-24. The session in progress at 9:00 PM Central today 2/20/24 would end at 4:00 PM Central tomorrow on Wednesday.
With Calculate set to OnEachTick or OnPriceChange printing Time[0] at 9:00 PM would return 2/21/24 5:00 PM, the close time of the current session day bar.
With Calculate set to OnBarClose Time[0] would return 2/20/24 5:00 PM from the previous bar close.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
16 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
||
Started by poplagelu, Today, 05:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by poplagelu
Today, 05:00 AM
|
||
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,407 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
Comment