Is there any way to determine, from code, the RTH hours for an instrument regardless of the template currently being used for the instrument?
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
Instrument RTH hours
Collapse
X
-
Hello Zeos6,
You can get the hours for a trading hours template. But if the template is not assigned to the instrument, then you will need to know the name of the template you want the hours from.
Below is a link to the help guide on the TradingHours.Sessions.
The Instrument.MasterInstrument.TradingHours has the template assigned to the instrument.
Chelsea B.NinjaTrader Customer Service
-
Hi Chelsea B,
Thank you for the reference and the quick reply. The reference you provided is somewhat helpful but not entirely. It is based on a session idx; i.e. Bars.TradingHours.Sessions[0].TradingDay.
More specifically, I'd like to know:
1. How can I retrieve the Trading hours (Session) template currently used by the instrument.
2. How can I retrieve a specific template by name, for example the trading hours for the CME US Index Futures RTH session template.
Thank you for your help.
Comment
-
Hello Zeos6,
Are you finding the Instrument.MasterInstrument.TradingHours I have suggested in my previous post is not returning the trading hours of the instrument?
As far as getting a template by name, use TradingHours.Get(string templateName).
The help guide has this on the BarsRequest page.
Chelsea B.NinjaTrader Customer Service
Comment
-
Good morning Chelsea B,
Thank you for your reply. It was helpful and I was able to retrieve the information.
One issue did come up though. Many of the Trading Hours templates in NT8 are specified in terms of Central Time. Is there a way to correct the output received from the inquiry, for example the BeginTime, for the actual time zone I am in (Eastern, UTC-05) without changing the templates? Thank you.
Also, is there a way to retrieve via code the time zone that the BeginTime, for example, is referenced to?
Comment
-
Hello Zeos6,
The time zone is in the TimeZoneInfo information.
You would need to use custom C# code to convert to other time zones.
Below is a public link to the microsoft documentation.
Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by bortz, 11-06-2023, 08:04 AM
|
47 responses
1,606 views
0 likes
|
Last Post
by aligator
Today, 07:22 PM
|
||
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
9 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
19 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
6 views
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
15 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
Comment