Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How can Ninjascript AddDataSeries reference a symbol universally
Collapse
X
-
How can Ninjascript AddDataSeries reference a symbol universally
How do I code Ninjascript AddDataSeries to reference a symbol without referencing its expiration date so it rolls over without code change.Tags: None
-
Hello ProfitPilgrim,
Thanks for your post.
You can use an overload that does not use a string to describe the instrument name, or you can use null for the instrument name to use the instrument of the primary data series. This is noted in the Warnings section of the AddDataSeries documentation page. I've requested that this gets moved to Tips so it is easier to find.
Publicly available AddDataSeries documentation can be found here - https://ninjatrader.com/support/help...dataseries.htm
If you are adding additional data series of other futures contracts, the full expiry must be used.
Please let me know if you have any additional questions.
-
Thanks Jim. Do I correctly understand that whenever the rollover date of added symbols in accustom indicator is reached, the indicator will stop working correctly until the code is modified, effectively every 1 to 3 months? As a vendor, that is awkward for clients leasing as they will all have to be updated with new code whenever added symbols rollover. Is there an alternative?
Comment
-
Hello ProfitPilgrim,
If "null" is passed as the instrument name, it will grab the instrument of the primary data series. The client should only have to hit the Rollover button to rollover and load the new front month. Once the chart is reloaded with the new front month, each NinjaScript will then be reloaded. Since the primary data series is updated and the script calls AddDataSeries(null, Data.BarsPeriodType.Minute, 5); or similar, the newly rollover Contract month will be used. You should not have to perform any additional work to update the script for the client.
Let me know if there is anything else I can do to help.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
640 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 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
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment