Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Add / Remove instrument from inside Ninja script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to Add / Remove instrument from inside Ninja script

    Hello,

    How to dynamically subscribe / unsubscribe to market data of certain instrument from inside Ninja script without restarting it?
    I develop connection to my external trading platform, which calls:
    public void subscribe(string Symbol, string Exchange);
    The ability to unsubscribe is also important because I use market depth data, and I want to keep the network traffic as low as possible.

    Please advise if there any workaround.

    #2
    Hello and welcome to the forum.

    Within NinjaScript you are required to define the list of instruments that will be monitored upon starting the script. While it's not supported, you can set these data series from user input or a custom list/external file. However, once the script begins running it is required the data series do not change and thus cannot be removed without terminating the script.

    For more on multiseries scripts:


    Let me know if I can further assist.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thank you NinjaTrader_Lance for a prompt reply. Yes, I see that this ability is not built-in. Is there any chance to find any solution that at least would look like required?
      For example, can I call again Initialize() without losing the data, or will it build a new Indicator object?
      Please note, I don't use any bar updates, but only OnMarketData() and OnMarketDepth().
      Last edited by velox; 12-31-2013, 01:21 PM.

      Comment


        #4
        I'll leave this open for others to answer as well, there isn't anything I can think of.
        Last edited by NinjaTrader_PatrickH; 10-08-2015, 06:21 AM. Reason: File is unavailable.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X