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

Instrument.GetInstrument returns null

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

    Instrument.GetInstrument returns null

    I have added the instrument "OMXS30YM".


    Instrument instr = Cbi.Instrument.GetInstrument("OMXS30YM");
    retruns null

    Instrument instr = Cbi.Instrument.GetInstrument("AAPL");
    does not return null

    This code snippet finds the instrument:

    var instrList = (from instrument in Instrument.All where instrument.FullName == "OMXS30YM" select instrument).ToList();
    Instrument instr = instrList[0];


    Do you know why

    Cbi.Instrument.GetInstrument("OMXS30YM")

    return null when the instrument exists?


    #2
    Hello ellefk,

    Thank you for your patience.

    Can you attach a screenshot of the Tools > Instruments > OMXS30YM Instrument window so I may investigate this matter further?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

    Click here for instructions: http://windows.microsoft.com/en-us/w...#1TC=windows-8

    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

    Click here for detailed instruction: http://take-a-screenshot.org/

    I look forward to your response.

    Comment


      #3
      See attached file

      See attached file of screenshot
      Attached Files

      Comment


        #4
        Hello ellefk,

        Thank you for your response.

        The Instrument needs to be set up as an Index rather than a Stock and then when you call it in the string please use the following:
        Code:
        Instrument instr = Cbi.Instrument.GetInstrument("^OMXS30YM");
        All indices require the "^" at the beginning of the name.

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elderan, Today, 08:03 PM
        0 responses
        2 views
        0 likes
        Last Post elderan
        by elderan
         
        Started by algospoke, Today, 06:40 PM
        0 responses
        10 views
        0 likes
        Last Post algospoke  
        Started by maybeimnotrader, Today, 05:46 PM
        0 responses
        9 views
        0 likes
        Last Post maybeimnotrader  
        Started by quantismo, Today, 05:13 PM
        0 responses
        7 views
        0 likes
        Last Post quantismo  
        Started by AttiM, 02-14-2024, 05:20 PM
        8 responses
        169 views
        0 likes
        Last Post jeronymite  
        Working...
        X