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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
80 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
40 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
63 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
63 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
54 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment