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

Multi Instrument Management

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

    Multi Instrument Management

    Hello My Friends,


    This thread is just to understand a little more how the strategies are built inside NT and the architecture behind multi instruments scripts.
    Please confirm or not what I found. I print some information in my Initialize() sub and every time I turn on NT it prints as expected. Any do my strategies were NOT enable which looks to me that all strategies are compiled and running in one block of script.
    That said, if I have 30 strategies or drafts or even pieces of test in my NT installation, it would run all and look for the enable ones at every tick, is that right? How bad is that for my performance in general? Do I have to clean up my drafts?
    Also, my multi instrument strategy might change the selected stocks every day. But when I turn on NT it loads the instruments before I clicked "Enable" in my Strategies tab. Then my strategy tries to add the new ones, leaving the instrument list a mess. Is there any way to:
    1) Revert the Add command when I disable the strategy or
    2) Not to load any instrument before I click "enable" or
    3) Avoid Initialize() sub before I click "Enable"



    My only way now is removing the strategy and set it up again, what is really a pain.


    Thank you!!
    mcosta72
    NinjaTrader Ecosystem Vendor - Quant-Wise

    #2
    Hello mcosta72,

    Thanks for the post.

    When you see the Initialize method run for each script, this is to populate UI elements. When you compile one script, all of the other scripts are compiled as well. None of these two items mentioned means that the other non-enabled scripts are running. If you have a strategy applied to your chart and enabled, that means it is running in the NinjaTrader process.

    I would recommend setting up your additional instruments by typing code only. I would suggest commenting out the instruments that you don't need. It would exceed the scope of support I can provide to find some workaround to the way that Initialize() is called.

    Please let us know if we may be of any further assistance.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,


      Thank you for replying,
      Regarding the first issue, I would like you to be more clear if having drafts of scripts can overload my memory since they are all compiled at the same context.
      Also, I have a piece of my script below. I cannot comment the old Add() instruments because they dynamic. I create a new "results.csv" file each day with the ticks I am going to work.



      private string path = @"C:\stocks\results.csv";


      protected override void Initialize()
      {
      str = File.ReadAllLines(path);
      lineCount = File.ReadAllLines(path).Length ;
      for(int x = 0 ; x < lineCount; x++)
      {
      Add(str[x], PeriodType.Minute , 1);
      }
      }


      I have a new file before start NT but it seems the compiled version calls the instruments used a day ago. Then I have to remove the strategy and set it up again in order to get my list refreshed. Any idea how to avoid the wrong loading?
      Thanks
      mcosta72
      NinjaTrader Ecosystem Vendor - Quant-Wise

      Comment


        #4
        Hello mcosta72,

        Thanks for the reply.

        Having many scripts in the bin/Custom folder will slow down NinjaTrader at compile time. There are no run-time effects from having multiple draft scripts.

        On the loading issue, you can press "F5" to refresh the NinjaScripts on your chart. If this will not update the instruments, NinjaTrader does have a special way that it caches data from the Initialize state once it is spun up on the chart. If that is the case, you would need to remove the strategy then re-add it.

        Please let us know if we may be of any further assistance.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Chris, Thank for your reply.


          Although this is not a good answer for me, I will try to find a way to cover this issue.
          Another question: Is there any way to import instruments via Script / Strategy or only through Import Instrm List tab?


          Thanks
          mcosta72
          NinjaTrader Ecosystem Vendor - Quant-Wise

          Comment


            #6
            Hello mcosta72,

            Thanks for the reply.

            It is not possible to import an instrument through a NinjaScript. The stock symbol importer must be used.

            Please let me know if I may be of any further assistance.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by philmg, Today, 01:17 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by cre8able, Today, 01:01 PM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by manitshah915, Today, 12:59 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by ursavent, Today, 12:54 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Mizzouman1, Today, 07:35 AM
            4 responses
            18 views
            0 likes
            Last Post Mizzouman1  
            Working...
            X