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 fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,404 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
95 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
7 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
159 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment