Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Getting Instrument RTH
Collapse
X
-
Hello Magzor,
Thanks for your note.
You could use the AddDataSeries() syntax below to specify the Trading Hours template you want to use when you add an additional series to the script.
AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
The instrumentName argument could be set to a blank string, such as " ", to set the added series to use the same instrument on the chart. However, you must specify the BarsPeriod type and value when adding your additional series.
An example of how the BarsPeriod might look could be seen in the sample code of the BarsPeriod help guide page linked below.
See the help guide documentation below for more information.
AddDataSeries: https://ninjatrader.com/support/help...dataseries.htm
BarsPeriod: https://ninjatrader.com/support/help...barsperiod.htm
Let me know if I may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Hi Brandon,
Thanks for your reply. I'm actually quite stuck gettting the session iterator to work. I have a multi-time series indicator. The bars array I use for session reference is index 5.
Here's how I've added the time series (at the bottom):Code:else if (State == State.DataLoaded) { //stores the sessions once bars are ready, but before OnBarUpdate is called sessionIterator = new SessionIterator(BarsArray[5]); }
And this is were I'm a bit stuck. How do I use the code example from the docs (https://ninjatrader.com/support/help.../?8_0_27_0.htm) in a multi time series indicator?Code:else if (State == State.Configure) { // Bars Array 0 is the trigger bar, should be the lowest // 1 is the cumulative Delta 1 tick AddDataSeries(Data.BarsPeriodType.Tick, 1); //add 1 tick bar chart for CD indicator // 2 is 5 min AddDataSeries(Data.BarsPeriodType.Minute, 5); // add 5min bars // 3 is 15 min AddDataSeries(Data.BarsPeriodType.Minute, 15); // add 15min bars // 4 is 60 min AddDataSeries(Data.BarsPeriodType.Minute, 60); // add 1hour bars // 5 is session iterator RTH chart reference AddDataSeries("ES", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 15 }, "US Equities RTH"); }
So for example, I have Bar X in BasArray[0] and I want to check if it's within the range of BarsArray[5] for that day. I guess I first need to check that the session Iterator exist, and so there might be an issue that I set it to 15 min, when array0 can be as low as a few seconds per bar.. So to be sure I guess I need to match those bar periods (which also seems a bit overkill just to check if we're inside a time range). Would it then me more efficient to just loop through the bar array 5 and check if it is the same date, and if it is, then get the high and the low value..?)
Last edited by Magzor; 12-12-2022, 10:09 AM.
Comment
-
Hehey, I think I managed to solve it now, there was a multitimeframe example in here: https://ninjatrader.com/support/help.../?8_0_27_0.htm
Comment
-
Hello Magzor,
Thanks for your note.
The SessionIterator help guide page's sample code demonstrates how to get the begin time and end time of a session. You could use that sample code and pass in BarsArray[5] when instantiating the session iterator in State.DataLoaded to get information about that added series.
You could then get the begin time and end time of that added series using the OnBarUpdate() code seen on the SessionIterator help guide page.Code:else if (State == State.DataLoaded) { //stores the sessions once bars are ready, but before OnBarUpdate is called sessionIterator = new SessionIterator(BarsArray[5]); }
See this help guide page for more information about SessionIterator and the sample code: https://ninjatrader.com/support/help...oniterator.htm
Let me know if I may further assist you.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
599 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
344 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
558 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
557 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment