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

Programmatically add a new instrument

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

    Programmatically add a new instrument

    How to programmatically add a new instrument?
    In 7 versions this was done by editing the "Instruments.txt" file

    #2
    Hello vladko,

    It is not supported to programmatically add an instrument to the NinjaTrader database in either NinjaTrader 7 or NinjaTrader 8.

    I will submit a feature request on your behalf to allow instruments to be created from a NinjaScript.

    This thread will remain open for any community members who may know of an unsupported way to achieve this and would like to share.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      What happens when manually updating the database? (from "Instruments" window)

      Comment


        #4
        Hello vladko,

        Any instruments you manually modify the settings for and save, will take effect once the data is reloaded.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I mean which files are updated?

          Comment


            #6
            Hello vladko,

            Instruments are saved in the NinjaTrader database located in:
            • Documents\NinjaTrader 8\db\NinjaTrader.sdf
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              I understand there is no proper customer support for this, but in an old NT7 thread, the adding of instruments in bulk was discussed as possible and efficient - using the intstruments.txt file.

              See the thread here: http://ninjatrader.com/support/forum...ad.php?t=34232

              I sorely miss such a feature and hope that maybe this is still an option in NT8, but I do not have the instruments.txt file format specs so that I could try it.

              Could you please shed some light here?

              Many thanks,

              Libor

              Comment


                #8
                Hello Libor,

                This method was not supported by NinjaTrader Support to do for NinjaTrader 7.

                That said, the Instruments.txt file is no longer used for NinjaTrader 8. Instead these settings are read from the NinjaTrader.sdf file in the Program Files directory.

                vladko,

                I failed to provide you with a tracking ID for you feature request.

                For future reference your request to allow instruments to be inserted into the NinjaTrader database via NinjaScript is being tracked with ID #SFT-1849.

                Please note, it is up to the NinjaTrader Development to decide if and when a request will be implemented.

                That said, I was working in a completely different area and might have found some undocumented and 100% unsupported code that might make this happen for you.
                Code:
                Account.All.First(a=> a.Name == "Sim101").Connection.ResolveSymbol("TestSymbol1", InstrumentType.Stock, Exchange.Default, NinjaTrader.Core.Globals.MaxDate, 0, OptionRight.Unknown, true, (resolvedInstrument, errorCode, errMsg, o) =>
                    {
                     resolvedInstrument.MasterInstrument.TickSize = 0.01;
                    }, null);
                Last edited by NinjaTrader_ChelseaB; 10-31-2019, 11:10 AM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Chelsea,

                  Thank you very much for this piece of code, it is exactly what I needed and works just fine.

                  You are the best, Chelsea!

                  Many thanks again,

                  Libor

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by CortexZenUSA, Today, 12:53 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post CortexZenUSA  
                  Started by CortexZenUSA, Today, 12:46 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post CortexZenUSA  
                  Started by usazencortex, Today, 12:43 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post usazencortex  
                  Started by sidlercom80, 10-28-2023, 08:49 AM
                  168 responses
                  2,266 views
                  0 likes
                  Last Post sidlercom80  
                  Started by Barry Milan, Yesterday, 10:35 PM
                  3 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X