I would like to filter Inside Days, based on a custom indicator, in the MarketAnalyzer.
See attached sample and code.
What's wrong with it?
namespace NinjaTrader.NinjaScript.Indicators { public class MyMaIndicator : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Filtering for ID for usage in Market Analyzer on a daily basis."; Name = "MyMaIndicator"; Calculate = Calculate.OnBarClose; IsOverlay = false; DisplayInDataBox = false; DrawOnPricePanel = false; DrawHorizontalGridLines = false; DrawVerticalGridLines = false; PaintPriceMarkers = false; 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. IsSuspendedWhileInactive = true; AddPlot(new Stroke(Brushes.HotPink, 2), PlotStyle.Square, "ID"); } else if (State == State.Configure) { } } protected override void OnBarUpdate() { if (CurrentBar < 2) return; if (High[0] <= High[1] && Low[0] >= Low[1]) ID[0] = 1; } #region Properties [Browsable(false)] [XmlIgnore] public Series<double> ID { get { return Values[0]; } } #endregion } }
Comment