Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Extra bars in Strategy included in calculations, but not NT chart
Collapse
X
-
sledge, thanks for the patience - we've amended our helpguide for the next update to cover your scenario - you will need to work with the <use instrument settings> here for your chart where you run the strategy from, the added VIX / TRIN would then use their RTH while the last DX instrument would use the default ETH hours for it.
From the to be updated help guide -
If a multi-series script adds an additional Bars object that already exists on the chart, the script will use the preexisting series instead of creating a new one to conserve memory. This includes that series' session template as applied from the chart. If the Bars object does not exist on the chart, the session template of the added Bars object will be the session template of the primary Bars object. If the primary Bars object is using the "<Use instrument settings>" session template then the additional Bars objects will use the default session templates as defined for their particular instrument in the Instrument Manager.
Comment
-
Hi Bertrand,
I've been struggling with this issue for a while now:
The problem I have is that I need to add a different timeframe for the same instrument with a different session template.
Reading the above post would I be able to solve it by doing the following as a work around:
1. Create a duplicate copy of instrument. Instrument is FGBL so create duplicate FGBLx
2. Set the default session template in instrument manager on FGBLx to the session template I am overriding with.
3. When calling Add(PeriodType.Minute,240); Put in the new duplicate instrument i.e. Add("FGBLx", PeriodType.Minute,240); Ensure calling chart is set to "Use instrument settings".
Do you think this would work or see any problems with it?
Thanks
Ross
Comment
-
The execution part is not a problem.
I tried it though and unfortunately have come across another problem, the second symbol FGBLx is unable to read from the Ninja History server as it's looking for that symbol name and no way that I can see to remap it to get FGBL historical data.
I went back again to my old attempt to use a full chart with one session and then block the code from executing bars in the onbarupdate that fall outside of the session time for the custom session:
if(Time[0].Hour>17&&Time[0].Minute>30)
return;
The problem with this approach is that while it does not execute the code it still seems to load the bars into the data series so that when the code does execute anything that refers to Close[1] etc. is all wrong since it refers to Bars that were skipped and not supposed to be part of the execution. Is there a way to suppress these bars without having them load into the bar series and having to write all sorts of weird and wonderful code to try and circumvent it?
Ross
Comment
-
Hi Bertand,
I've thought about this some more and I was thinking, it would seem the initial problem I have of having to modify all the code around the skipped section could easily be remedied if there was some sort of function within the onBarUpdate that would allow me to suppress the adding of the bar to the bar series. Do you know if something like that exists?
Cheers
Ross
Comment
-
Hi Ross, for the data you could look into importing data manually for the custom symbol via a textfile for example. For a code wise solution, there's unfortunately nothing in NinjaScript that would assist here, a custom arraylist would be needed to maintain your base calculation values which would then in turn be used for the indicator calculations.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
669 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
378 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 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
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
580 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment