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 GLFX005, Today, 03:23 AM
      0 responses
      2 views
      0 likes
      Last Post GLFX005
      by GLFX005
       
      Started by XXtrader, Yesterday, 11:30 PM
      2 responses
      11 views
      0 likes
      Last Post XXtrader  
      Started by Waxavi, Today, 02:10 AM
      0 responses
      7 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by TradeForge, Today, 02:09 AM
      0 responses
      14 views
      0 likes
      Last Post TradeForge  
      Started by Waxavi, Today, 02:00 AM
      0 responses
      3 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Working...
      X