#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class ChartLabel : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Adds a customizable label to the chart"; Name = "Chart Label"; Calculate = Calculate.OnBarClose; IsOverlay = true; IsSuspendedWhileInactive = true; Label = ""; } } protected override void OnBarUpdate() { } public override string DisplayName { get { return Label; } } [NinjaScriptProperty] [Display(Name = "Label", GroupName = "Chart Label", Order = 1)] public string Label { get; set; } } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private ChartLabel[] cacheChartLabel; public ChartLabel ChartLabel(string label) { return ChartLabel(Input, label); } public ChartLabel ChartLabel(ISeries input, string label) { if (cacheChartLabel != null) for (int idx = 0; idx < cacheChartLabel.Length; idx++) if (cacheChartLabel[idx] != null && cacheChartLabel[idx].Label == label && cacheChartLabel[idx].EqualsInput(input)) return cacheChartLabel[idx]; return CacheIndicator(new ChartLabel(){ Label = label }, input, ref cacheChartLabel); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.ChartLabel ChartLabel(string label) { return indicator.ChartLabel(Input, label); } public Indicators.ChartLabel ChartLabel(ISeries input , string label) { return indicator.ChartLabel(input, label); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.ChartLabel ChartLabel(string label) { return indicator.ChartLabel(Input, label); } public Indicators.ChartLabel ChartLabel(ISeries input , string label) { return indicator.ChartLabel(input, label); } } } #endregion