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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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 :
BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ZeroKuhl, Yesterday, 04:31 PM
|
7 responses
40 views
0 likes
|
Last Post Today, 02:07 PM | ||
Started by xepher101, Today, 12:19 PM
|
1 response
21 views
0 likes
|
Last Post Today, 01:58 PM | ||
Started by jpeep, 08-16-2020, 08:31 AM
|
16 responses
498 views
0 likes
|
Last Post Today, 01:57 PM | ||
Started by sastrades, Today, 09:59 AM
|
1 response
12 views
0 likes
|
Last Post Today, 01:56 PM | ||
Started by DawnTreader, 05-08-2024, 05:58 PM
|
14 responses
46 views
0 likes
|
Last Post
by DawnTreader
Today, 01:47 PM
|
Comment