Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get current Contract Name

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

    Get current Contract Name

    I am working on an Indicator that references more than one symbol to measure overall market direction.

    I'd like to write this so that whenever the the contract rolls over to the latest contract that I will not need to modify the indicator.

    So is that something that I can query to get the latest name of the contract say the Nikkei 225 Futures, or DAX?

    #2
    Also, how would I set it so that it uses whatever timeframe it is being added to?

    Comment


      #3
      Hello ATMtrader0001,

      Thanks for your question.

      The primary instrument can be inherited in AddDataSeries by specifying null as the instrument name.

      AddDataSeries(null, BarsPeriodType.Minute, 5);

      Separate instruments can be added using the same time frame as the primary data series using

      AddDataSeries(string instrumentName)

      Full instrument names must otherwise be hardcoded into the script and the expiry of that instrument must be known. Some clients have decided to use Instrument.GetInstrumentFuzzy to get the current expiry of an instrument. This is not supported/documented code, but you may find some use from it. Use at your own risk.

      Print(Instrument.GetInstrumentFuzzy("@ES").FullNam e);

      AddDataSeries documentation can be found here - https://ninjatrader.com/support/help...dataseries.htm

      We look forward to being of further assistance.

      Comment


        #4
        Jim,

        Thanks for your post, it was helpful.

        I'll figure out a way to do this.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X