• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.Accounts.First(a=> a.Name == "Sim101").Connection.ResolveSymbol("TestSymbol1", InstrumentType.Stock, Exchange.Default, Globals.MaxDate, 0, OptionRight.Unknown, true, (resolvedInstrument, errorCode, errMsg, o) =>
                    {
                     resolvedInstrument.MasterInstrument.TickSize = 0.01;
                    }, null);
                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 pjsmith, Today, 08:14 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post pjsmith
                  by pjsmith
                   
                  Started by levikNT, Today, 07:36 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChristopherD  
                  Started by TazoTodua, Today, 07:27 AM
                  1 response
                  4 views
                  0 likes
                  Last Post NinjaTrader_JoshG  
                  Started by KennyK, Yesterday, 09:47 PM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by Dogmatichacker, Yesterday, 03:52 PM
                  1 response
                  15 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X