private string ticker;
Add("SPY", PeriodType.Day, 1);
....store the string "SPY" in ticker....
Print(ticker);
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Getting ticker of added instrument?
Collapse
X
-
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 PostIs 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?Originally posted by clocker View PostIs 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
-
In that case,Originally posted by clocker View PostI 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.
will show you which ticker is being processed at any given time.Code:ticker = Instruments[BarsInProgress].MasterInstrument.Name;
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
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
333 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment