Any assistance is greatly appreciated.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
list of instruments
Collapse
X
-
list of instruments
Hi, in my indicator I would like a drop down list in the parameter settings section of all available instruments in my "Default" instrument list. My indicator is designed to run based off of another instrument that correlates to the one defined for the chart. This list will enable me to select which instrument I want to correlate.
Any assistance is greatly appreciated.Tags: None
-
Hello FCatan,
Thank you for your inquiry.
Please note that this method is only an example and is unsupported. This will be only pulling the FullName string from the instrument list.
Please ensure that you have using System.Collections.Generic; in your using declarations.
Ensure that the code below is outside of your indicator's class:Code:protected override void Initialize() { NinjaTrader.Cbi.InstrumentList listOfInstruments = NinjaTrader.Cbi.InstrumentList.GetObject("Default"); List<string> AvailableInstruments = new List<string>(); foreach (Instrument instrument in listOfInstruments.Instruments) { AvailableInstruments.Add(instrument.FullName); } ArrayAvailableInstruments = AvailableInstruments.ToArray(); } private string theListOfInstruments; [Description("Instruments")] [GridCategory("Parameters")] [TypeConverter(typeof(StringListConverter))] public string TheListOfInstruments { get { return theListOfInstruments; } set { theListOfInstruments = value; } } [Browsable(false)] public string[] ArrayAvailableInstruments { set { StringListConverter.value = value; } }
For further information about this, please take a look at this link: http://exploitcsharp.blogspot.com/20...n-list-in.htmlCode:public sealed class StringListConverter : StringConverter { public static string[] value; public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return true; } public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(value); } }
I would suggest reading more about the use of type converters in C#: https://msdn.microsoft.com/en-us/library/ayybcxe5.aspxZachary G.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
330 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
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment