Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting ticker of added instrument?

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

    Getting ticker of added instrument?

    Is it possible to get the ticker of an added instrument?

    Code:
    private string ticker;
    Add("SPY", PeriodType.Day, 1);
    
    ....store the string "SPY" in ticker....
    
    Print(ticker);

    #2
    You could make a string for SPY in the variable section

    or use substring if needed on this example (Be sure of BarsInProgress==1..



    NT Tips:
    2.When working with multi-series indicators, Input always references BarsInProgress 0. Please be mindful as to when you access Input[0] as you will only be able to do so after BarsInProgress 0 has bars. To check to ensure BarsInProgress 0 has some bars you can use CurrentBars[0] to check.


    Originally posted by clocker View Post
    Is it possible to get the ticker of an added instrument?

    Code:
    private string ticker;
    Add("SPY", PeriodType.Day, 1);
    
    ....store the string "SPY" in ticker....
    
    Print(ticker);

    Comment


      #3
      Thanks I don't think that's quite what I needed. I mean something like the ".tag" property. Preferably not to have create a string variable for each ticker I add.

      Comment


        #4
        Try "Instruments[x].MasterInstrument.Name"

        Comment


          #5
          Originally posted by clocker View Post
          Is it possible to get the ticker of an added instrument?

          Code:
          private string ticker;
          Add("SPY", PeriodType.Day, 1);
          
          ....store the string "SPY" in ticker....
          
          Print(ticker);
          You are declaring ticker anyway. Why not just initialize it when you declare it?

          Comment


            #6
            I was illustrating what I want to do since I already had a series of Add() methods. The "ticker" variable is to get my point across.

            Comment


              #7
              Originally posted by clocker View Post
              I was illustrating what I want to do since I already had a series of Add() methods. The "ticker" variable is to get my point across.
              In that case,

              Code:
              ticker = Instruments[BarsInProgress].MasterInstrument.Name;
              will show you which ticker is being processed at any given time.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              574 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              333 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X