Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

US 10 Year bonds instrument

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

    US 10 Year bonds instrument

    Hi

    I am struggling to find the US 10 year bonds instrument, in the instrument list I have.

    Can support either point me at the correct instrument name or point me at a help guide reference that explains how to load it.

    Kind regards

    Duncan

    #2
    Hello EastLondonKiwi,

    Thank you for your post,

    The 10 Year US Bonds is listed in NinjaTrader as "ZN."

    To view this, I suggest going to New > Chart > Select the magnifying glass > Search "ZN" and select by double-clicking > OK to open the chart.

    Once this is complete, you'll then be able to access the ZN from every instrument drop-down list.

    https://ninjatrader.com/support/help...ntselector.htm

    Let us know if we may assist further.
    Eric B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Eric. I'll check out ZN.

      in Ninja script 8 what is the method I could call that lists all the Instruments? and what properties can be derived from it?

      Eg Name, Type (Futures, Forex) etc...

      Kind regards

      Duncan

      Comment


        #4
        Thank you for your question Duncan. While there is no supported method for doing this, other users have had some luck investigating the undocumented object NinjaTrader.Cbi.InstrumentList.All . Undocumented code can not be supported nor guaranteed to be maintained. However, for the moment, the following block of code will work.

        Code:
        
                protected override void OnBarUpdate()
                {
                    foreach(NinjaTrader.Cbi.InstrumentList l in NinjaTrader.Cbi.InstrumentList.All)
                    {
                        Print(l.Name);
                        foreach(Instrument i in l.Instruments)
                        {
                            Print(i.FullName);
                        }
                    }
                }
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Jessica you are a star

          Comment


            #6
            Jessica Ok I am getting there.

            Firstly. Calling NinjaTrader.Cbi.Instrument must be within the method OnStateChange, trying to call it from OnBarUpdate causes an error

            Once I figured that out I got results I was after

            Then I realised the Instrument list is a derived list made by a User, and is not the list of Instrument I want to check. I am after the entire list of instruments my NinjaTrader database contains. So based on your example I got to this point.

            Code:
            foreach (NinjaTrader.Cbi.Instrument l in NinjaTrader.Cbi.Instrument.All)
            {
               Print(l.MasterInstrument.Name)
            {
            However. this is now more data than I need and I want to only add to a variable those name where the InstrumentType equals "Forex"

            but I am having a blond moment and can not figure out how to cast l.MasterInstrument.InstrumentType to a string. I had thought this would work, but I was wrong:

            Code:
            foreach (NinjaTrader.Cbi.Instrument l in NinjaTrader.Cbi.Instrument.All)
            {
               where(l.MasterInstrument.InstrumentType.ToString.Contains("Forex"))
                    {
                       Print(l.MasterInstrument.Name)
                    }
            {
            Can you advise

            Thanks

            Duncan

            Comment


              #7
              We are discussing undocumented functionality and parts of NinjaTrader we do not directly support. Discovering how to filter down to a specific instrument list is a trial and error investigative process. This said the code example I posted earlier was tried inside an indicator's onbarupdate routine, and if you will carefully analyze the difference between my code and your code I believe you will be able to see a point where the code I posted is capable of making this distinction already. I recommend running it in a new indicator as the indicator's entire onbarupdate method, with a ninjascript output window already open, then pressing ctrl+a, ctrl+c inside the output window, and finally pasting the copied output into your favorite text editor. If you look inside the output for a known symbol, for example, the ES 06-17, then look upward from there, and compare this to the code, you should be able to discover how to filter based on instrument list.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Jessica

                I will look at your code again and access, however I am still sure the list in your code is the derived lists to enable a user to group specific instruments together making finding them later easier, and while I could use these lists as the basis for my indicator, I would rather have a more generic method I can use for wider purposes. So I will keep battling on with figuring out how to address the output. Oh and for clarification I am using the Output window for assessing the results.

                Ok that said can you also have a look at the instrument ZN 06-17 that is the US 10 year bonds futures instrument.

                I found that instrument in the database, and I can add that to a chart, but I get no data from it? does that mean I am limited in the data type my licenses allows me to access or is there some other issue I need to address.

                Thanks

                Duncan

                Comment


                  #9
                  Originally posted by EastLondonKiwi View Post
                  I found that instrument in the database, and I can add that to a chart, but I get no data from it? does that mean I am limited in the data type my licenses allows me to access
                  Usually this is the case. I would like to invite you to visit Tools -> Instruments, find and edit your ZN instrument, and compare your settings to those I have attached, to ensure that your instrument mappings are not causing this. 06-17 is a recent expiry date.
                  Attached Files
                  Jessica P.NinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Jessica

                    My settings match your settings, so I have to assume it's my data feed.

                    Thanks

                    Duncan

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Pete77, Today, 10:22 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post Pete77
                    by Pete77
                     
                    Started by dtl-saw, Today, 08:51 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post dtl-saw
                    by dtl-saw
                     
                    Started by Lindsay10, Today, 08:22 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Jason  
                    Started by Carlito178, Today, 06:49 AM
                    3 responses
                    13 views
                    0 likes
                    Last Post NinjaTrader_Jason  
                    Started by space_trader, Today, 04:20 AM
                    0 responses
                    10 views
                    0 likes
                    Last Post space_trader  
                    Working...
                    X