Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Tradin Hours Template
Collapse
X
-
Tradin Hours Template
Hello community, I am trying to integrate ninjatrader trading hours into my indicator, I can't find a solution, could you give me the procedure to follow? Thank youTags: None
-
Hello Valtrading,
The primary series of the indicator will always be the primary series of the input series (chart bars) and will use the Trading hours selected for the chart data series in the Data Series window.
Using a variable with AddDataSeries() is not supported, so this would not be something our team would support for a secondary series.
From the help guide:
"Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."
Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
If you wanted to use AddDataSeries() the tradingHoursTemplate string would need to be hard coded.
You could use a TradingHours variable with a BarsRequest.
Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
If you did a BarsRequest with the chart data series using Default 24 / 7 you could push the data into a custom Series<double> if you wanted to use the data with indicator calls.
Below is a link to an example of pushing data from a BarsRequest to a series.
Chelsea B.NinjaTrader Customer Service
-
Thank you for your response. However, I didn't fully understand your explanation.
I thought there was a NinjaTrader method to directly "integrate" this parameter into our indicator. Could you clarify this point?
From what I understand, we need to add a new data series with the desired trading hours, and this series will not be visible on the screen but will be hardcoded in the indicator. Is that correct?
Could you provide a code example for this?
Thank you.
Comment
-
Hello Valtrading,
"I thought there was a NinjaTrader method to directly "integrate" this parameter into our indicator. "
Not quite. The Trading Hours is part of the Data Series window parameters. You can create an input of a TradingHours input, however it's using that variable to fetch data that is the issue.
Variables are not supported with AddDataSeries().
A supported way to call AddDataSeries() and specify the TradingHours template name.
AddDataSeries(null, new BarsPeriod(){ BarsPeriodType = BarsPeriodType.Minute, Value = 1}, "CME US Index Futures RTH");
AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.
So if you wanted to use a TradingHours as a custom input when fetching additional data, the only fully supported method would be to use it with a BarsRequest.
Note, if you choose to use unsupported code and supply the TradingHours from an input variable to AddDataSeries() this will mostly work on a real-time chart. The issues will arise when trying to optimize a strategy that calls the indicator.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
557 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment