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!
See more
See less

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 iceman2018, Today, 05:07 PM
        0 responses
        4 views
        0 likes
        Last Post iceman2018  
        Started by rhyminkevin, Today, 04:58 PM
        0 responses
        24 views
        0 likes
        Last Post rhyminkevin  
        Started by lightsun47, Today, 03:51 PM
        0 responses
        6 views
        0 likes
        Last Post lightsun47  
        Started by 00nevest, Today, 02:27 PM
        1 response
        14 views
        0 likes
        Last Post 00nevest  
        Started by futtrader, 04-21-2024, 01:50 AM
        4 responses
        49 views
        0 likes
        Last Post futtrader  
        Working...
        X