I'm trying to create a dropdown sounds picker to go with NinjaTrader_Alan's Inside Bar indicator. I need it to avoid having to hardcode it on multiple versions of the same indicator for each chart.
So far I've researched those sources to find how to do it https://ninjatrader.com/support/foru...225#post775225 https://ninjatrader.com/support/foru...976#post671976 https://ninjatrader.com/support/foru...409#post805409
I updated NinjaTrader_Alan Inside bar indicator based on his recommendation from the 3rd link above. Script in attachment.
I added those:
#region Properties // Create our user definable color input [XmlIgnore()] [Display(Name = "BorderBrush", GroupName = "NinjaScriptParameters", Order = 0)] public Brush BorderBrush { get; set; } // Serialize our Color object [Browsable(false)] public string BorderBrushSerialize { get { return Serialize.BrushToString(BorderBrush); } set { BorderBrush = Serialize.StringToBrush(value); } } [B]//dropdown sounds picker [NinjaScriptProperty] [TypeConverter(typeof(NinjaTrader.NinjaScript.Indic ators.AlanIndicators.SoundConverter))] public string SoundFiles {get;set;}[/B] #endregion
[B]public class SoundConverter : TypeConverter { public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { if (context == null) { return null; } //List <string> list; List <string> list = new List <string> (); DirectoryInfo dir = new DirectoryInfo(NinjaTrader.Core.Globals.InstallDir+ "sounds"); FileInfo[] files= dir.GetFiles("*.wav"); foreach (FileInfo file in files) { list.Add(file.Name); } return new TypeConverter.StandardValuesCollection(list);[/B] } [B]public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; }[/B] }
I get those errors:
InsideBarPaintedUserSpecifiedColor.cs | The type or namespace name 'DirectoryInfo' could not be found (are you missing a using directive or an assembly reference?) | CS0246 | 118 | 4 |
InsideBarPaintedUserSpecifiedColor.cs | The type or namespace name 'DirectoryInfo' could not be found (are you missing a using directive or an assembly reference?) | CS0246 | 118 | 28 |
InsideBarPaintedUserSpecifiedColor.cs | The type or namespace name 'FileInfo' could not be found (are you missing a using directive or an assembly reference?) | CS0246 | 120 | 4 |
InsideBarPaintedUserSpecifiedColor.cs | The type or namespace name 'FileInfo' could not be found (are you missing a using directive or an assembly reference?) | CS0246 | 122 | 13 |
Comment