I am having a heak of a time trying to fix a serialization issue:
One thing worth mentioning that the code does not plot anything but does draw text on each Point and Figure bar. I know most common serialization issues comes from color but am stumped on how to fix it.
I have researched this: http://www.ninjatrader.com/support/f...ead.php?t=4977
Here is the code causing me issues..
Code:
#region Using declarations using System; using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Data; using NinjaTrader.Gui.Chart; #endregion // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// Enter the description of your new custom indicator here /// </summary> [Description("Enter the description of your new custom indicator here")] public class PnFCount : Indicator { #region Variables private int BoxSize = 7; public DataSeries count; #endregion /// <summary> /// This method is used to configure the indicator and is called once before any bar data is loaded. /// </summary> protected override void Initialize() { Overlay = true; count = new DataSeries(this); CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if(CurrentBar <= 4)return; count[0] = Math.Round((((High[0] - Low[0])/TickSize)/BoxSize)+1,0); if (FirstTickOfBar) { Print("High: "+High[1]+" Low: "+Low[1]); } if(Open[0] < Close[0]) { DrawText("count"+CurrentBar.ToString(),count[0].ToString(),0,Close[0]+(BoxSize*TickSize),Color.DimGray); } else { DrawText("count"+CurrentBar.ToString(),count[0].ToString(),0,Close[0]-(BoxSize*TickSize),Color.DimGray); } } #region Properties [Description("Numbers of bars used for calculations")] [GridCategory("Parameters")] public int Box_Size { get { return BoxSize; } set { BoxSize = Math.Max(1, value); } } #endregion } } #region NinjaScript generated code. Neither change nor remove. // This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { public partial class Indicator : IndicatorBase { private PnFCount[] cachePnFCount = null; private static PnFCount checkPnFCount = new PnFCount(); /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public PnFCount PnFCount(int box_Size) { return PnFCount(Input, box_Size); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public PnFCount PnFCount(Data.IDataSeries input, int box_Size) { if (cachePnFCount != null) for (int idx = 0; idx < cachePnFCount.Length; idx++) if (cachePnFCount[idx].Box_Size == box_Size && cachePnFCount[idx].EqualsInput(input)) return cachePnFCount[idx]; lock (checkPnFCount) { checkPnFCount.Box_Size = box_Size; box_Size = checkPnFCount.Box_Size; if (cachePnFCount != null) for (int idx = 0; idx < cachePnFCount.Length; idx++) if (cachePnFCount[idx].Box_Size == box_Size && cachePnFCount[idx].EqualsInput(input)) return cachePnFCount[idx]; PnFCount indicator = new PnFCount(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Box_Size = box_Size; Indicators.Add(indicator); indicator.SetUp(); PnFCount[] tmp = new PnFCount[cachePnFCount == null ? 1 : cachePnFCount.Length + 1]; if (cachePnFCount != null) cachePnFCount.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cachePnFCount = tmp; return indicator; } } } } // This namespace holds all market analyzer column definitions and is required. Do not change it. namespace NinjaTrader.MarketAnalyzer { public partial class Column : ColumnBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.PnFCount PnFCount(int box_Size) { return _indicator.PnFCount(Input, box_Size); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.PnFCount PnFCount(Data.IDataSeries input, int box_Size) { return _indicator.PnFCount(input, box_Size); } } } // This namespace holds all strategies and is required. Do not change it. namespace NinjaTrader.Strategy { public partial class Strategy : StrategyBase { /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> [Gui.Design.WizardCondition("Indicator")] public Indicator.PnFCount PnFCount(int box_Size) { return _indicator.PnFCount(Input, box_Size); } /// <summary> /// Enter the description of your new custom indicator here /// </summary> /// <returns></returns> public Indicator.PnFCount PnFCount(Data.IDataSeries input, int box_Size) { if (InInitialize && input == null) throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); return _indicator.PnFCount(input, box_Size); } } } #endregion
Comment