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, 05-11-2026, 05:56 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
23 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
186 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
345 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
266 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|

Comment