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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
156 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
90 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
138 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
130 views
1 like
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
107 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment