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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X