protected override void OnStateChange() { if (State == State.SetDefaults) { Name = Custom.Resource.DrawingToolIndicatorName; Description = Custom.Resource.DrawingToolIndicatorDescription; IsOverlay = true; IsChartOnly = true; DisplayInDataBox = false; PaintPriceMarkers = false; IsSuspendedWhileInactive = true; SelectedTypes = new XElement("SelectedTypes"); foreach (Type type in new[] { typeof(DrawingTools.Ellipse), typeof(DrawingTools.ExtendedLine), typeof(DrawingTools.FibonacciExtensions), typeof(DrawingTools.FibonacciRetracements), typeof(DrawingTools.HorizontalLine), typeof(DrawingTools.Line), typeof(DrawingTools.Ray), typeof(DrawingTools.Rectangle), typeof(DrawingTools.Text), typeof(DrawingTools.VerticalLine) }) { XElement el = new XElement(type.FullName); el.Add(new XAttribute("Assembly", "NinjaTrader.Custom")); SelectedTypes.Add(el); } Left = 5; Top = -1; NumberOfRows = 5; } else if (State == State.Historical) { if (IsVisible) { if (ChartControl != null) { if (Top < 0) { Top = 25; } ChartControl.Dispatcher.InvokeAsync(() => { UserControlCollection.Add(CreateControl()); }); } } } }
protected override void OnStateChange() { if (State == State.SetDefaults) { Name = Custom.Resource.DrawingToolIndicatorName; Description = Custom.Resource.DrawingToolIndicatorDescription; IsOverlay = true; IsChartOnly = true; DisplayInDataBox = false; PaintPriceMarkers = false; IsSuspendedWhileInactive = true; SelectedTypes = new XElement("SelectedTypes"); //foreach (Type type in Core.Globals.AssemblyRegistry.GetDerivedTypes(typeof(DrawingTools.DrawingTool))) foreach (Type type in new[] { typeof(DrawingTools.Ellipse), typeof(DrawingTools.ExtendedLine), typeof(DrawingTools.FibonacciExtensions), typeof(DrawingTools.FibonacciRetracements), typeof(DrawingTools.HorizontalLine), typeof(DrawingTools.Line), typeof(DrawingTools.Ray), typeof(DrawingTools.Rectangle), typeof(DrawingTools.Text), typeof(DrawingTools.VerticalLine) }) { XElement el = new XElement(type.FullName); //string assemblyName = Core.Globals.AssemblyRegistry.IsNinjaTraderCustomAssembly(type) ? "NinjaTrader.Custom" : type.Assembly.GetName().Name; el.Add(new XAttribute("Assembly", "NinjaTrader.Custom")); SelectedTypes.Add(el); } Left = 5; Top = -1; NumberOfRows = 5; } else if (State == State.Configure) { if (IsVisible) { if (ChartControl != null && Top < 0) { Top = 5 + ChartControl.HeaderHeight; } UserControlCollection.Add(CreateControl()); } } }