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 FullName issue

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

    Instrument FullName issue

    Hi.

    I'd like to get the full name of a future instrument from its short name.
    For example, I'd like to get "MNQ 03-21" from just "MNQ".

    When I use this line of code :
    Print(Instrument.GetInstrument("MNQ").FullName);
    That just print "MNQ"

    How can I get the expiry date of an instrument contract ?

    Regards.

    #2
    And I would like to precise that I've tried the 'expiry' property :
    When I do :
    Print(Instrument.GetInstrument("MNQ").Expiry);
    I get : 01/12/2099 00:00:00

    And when I do :
    Print(Instrument.GetInstrument("MNQ 03-21").Expiry);
    I get : 01/03/2021 00:00:00

    How can I get 01/03/2021 00:00:00 with just "MNQ" as an entry ?

    Comment


      #3
      Hello thanajo,

      Thank you for the post.

      The Getinstrument method would need the full instrument name to locate it, that would include the contract. Generally for futures instruments and getting the name it would be the other way around, because your script is using a specific contract you would be able to get the MasterInstrument and its Name which would be just MNQ.

      The platform in general is not set up to use a futures instrument without a contract month specified. If the code you tried returned an instrument and did not have an error you may have a duplicate stock type instrument defined named MNQ, you would need to check the instrument manager to confirm that.


      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by LiamTwine, Today, 08:10 AM
      0 responses
      2 views
      0 likes
      Last Post LiamTwine  
      Started by Balage0922, Today, 07:38 AM
      0 responses
      5 views
      0 likes
      Last Post Balage0922  
      Started by JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      19 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      6 views
      0 likes
      Last Post Creamers  
      Working...
      X