Do I really need it "override" directive or and I doing something else wrong?.
Thanks for your help.
#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 LogrithmicTrend : Indicator { public ChartAnchor Anchor1 { get; set; } public ChartAnchor Anchor2 { get; set; } public ChartAnchor Anchor3 { get; set; } // Create the Anchor Collection public override IEnumerable<ChartAnchor> Anchors { get { return new[] {Anchor1, Anchor2, Anchor3}; } } protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Attempt to build a logrithmic trend indicator"; Name = "LogrithmicTrend"; Calculate = Calculate.OnBarClose; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. Anchor1 = new ChartAnchor(); Anchor2 = new ChartAnchor(); Anchor3 = new ChartAnchor(); Anchor1.DisplayName = "First Marker"; Anchor2.DisplayName = "Second Marker"; Anchor3.DisplayName = "Last Marker"; Anchor1.IsBrowsable = false; Anchor2.IsBrowsable = false; Anchor3.IsBrowsable = false; IsSuspendedWhileInactive = true; CurveColor = Brushes.Gold; AddPlot(Brushes.Orange, "CurveLine1"); } else if (State == State.Configure) { } } protected override void OnRender (ChartControl chartControl, ChartScale chartScale) { foreach (ChartAnchor anchor in Anchors) { Print (anchor.DisplayName); } } protected override void OnBarUpdate() { //Add your custom indicator logic here. } #region Properties [NinjaScriptProperty] [XmlIgnore] [Display(Name="CurveColor", Description="Curve Color", Order=1, GroupName="Parameters")] public Brush CurveColor { get; set; } [Browsable(false)] public string CurveColorSerializable { get { return Serialize.BrushToString(CurveColor); } set { CurveColor = Serialize.StringToBrush(value); } } [Browsable(false)] [XmlIgnore] public Series<double> CurveLine1 { get { return Values[0]; } } #endregion }
Comment