Basically this is the same as manually starting/stopping the same strategy on several individual instruments. But the number of instruments is going to be anywhere between 10 and 50, and their set needs to adjusted every hour or so - this certainly too much for the manual work, so would be really nice to automate it. Any help is greatly appreciated. Thanks.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding and removing instruments from within a strategy
Collapse
X
-
Adding and removing instruments from within a strategy
I have a strategy that should be applied to the preselected set of instruments, so what I need to do is have it periodically read the external source (file, DB, web service, etc.) that will supply the list of instruments. The strategy then would need to remove the instruments from its BarsArray (I guess) which are no longer in effect and add the new ones (those not yet in the BarsArray). There's actually no correlation or connection between the instruments needed. The strategy should just watch them separately to find the suitable enter/exit points. It seems that Add() method would do the trick, but the documentation says that it can only be executed on Initialize().
Basically this is the same as manually starting/stopping the same strategy on several individual instruments. But the number of instruments is going to be anywhere between 10 and 50, and their set needs to adjusted every hour or so - this certainly too much for the manual work, so would be really nice to automate it. Any help is greatly appreciated. Thanks.Tags: None
-
Hi kltdco,
Thanks for the post and welcome to the NinjaTrader forums! We currently do not support dynamic adding / removing of instruments in a multiseries script. The only way to use is hard code into Initialize().
Since there is no correlation or connection between the instruments, you could get by running a single instrument strategy, but running against a list of instruments. This creates a separate strategy instance for each instrument in the list.Ryan M.NinjaTrader Customer Service
-
Thanks for your reply. I'll be happy to implement any solution that would do the job I need. Can you please elaborate or point me to where I can read/get more info on running a strategy against a list? Also, can this list be programmatically managed? Thanks.
Comment
-
Sorry kltdco, yes you could enable strategies on a instrument list from the strategies tab -
The creation of instrument lists though is not dynamic / doable via coding in this case : you would want to consider stock symbols in bulk via this feature, they are then added to a list of your choosing as well :
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
666 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
377 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
110 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