Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

US 10 Year bonds instrument

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

  • EastLondonKiwi
    replied
    Thanks Jessica

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

    Thanks

    Duncan

    Leave a comment:


  • NinjaTrader_JessicaP
    replied
    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

    Leave a comment:


  • EastLondonKiwi
    replied
    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

    Leave a comment:


  • NinjaTrader_JessicaP
    replied
    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.

    Leave a comment:


  • EastLondonKiwi
    replied
    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

    Leave a comment:


  • EastLondonKiwi
    replied
    Thanks Jessica you are a star

    Leave a comment:


  • NinjaTrader_JessicaP
    replied
    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:
    [FONT=Courier New]
            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);
                    }
                }
            }[/FONT]

    Leave a comment:


  • EastLondonKiwi
    replied
    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

    Leave a comment:


  • NinjaTrader_EricB
    replied
    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.

    Leave a comment:


  • EastLondonKiwi
    started a topic US 10 Year bonds instrument

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by maybeimnotrader, Yesterday, 05:46 PM
3 responses
23 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by adeelshahzad, Today, 03:54 AM
5 responses
32 views
0 likes
Last Post NinjaTrader_BrandonH  
Started by stafe, 04-15-2024, 08:34 PM
7 responses
32 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by merzo, 06-25-2023, 02:19 AM
10 responses
823 views
1 like
Last Post NinjaTrader_ChristopherJ  
Started by frankthearm, Today, 09:08 AM
5 responses
23 views
0 likes
Last Post NinjaTrader_Clayton  
Working...
X