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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      22 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X