I have a super simple indicator I hace placed on 4 charts, but some of the charts it seems that eventhough the data are there the indicator keeps on loading.
I need to close the window and create a new one then it works again until I change symbol then it crashes again sometimes please see attached image.
I use Interactive Brokers as the data provider.
public class TheStratScenarios : Indicator { private string scenario; private SolidColorBrush scenarioBrush; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Indicator here."; Name = "TheStratScenarios"; Calculate = Calculate.OnBarClose; IsOverlay = true; 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. IsSuspendedWhileInactive = true; //Setting Default Colors ColorIB = Brushes.Gold; ColorTrend = Brushes.White; ColorOB = Brushes.Red; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { if(CurrentBar==0) return; string scenario = GetScenario(); //Draw.Text(this, CurrentBar.ToString(), scenario, 0, Low[0] - (Low[0]/150),scenarioBrush ); Draw.Text(this,CurrentBar.ToString(),false,scenari o,0, Low[0], -80, scenarioBrush, new SimpleFont("Verdana",12), TextAlignment.Center,Brushes.Transparent,Brushes.T ransparent,0); } private string GetScenario() { string scenario = "0"; if(High[0] <= High[1] && Low[0] >= Low[1]) {//Inside Bar scenario = "1"; scenarioBrush = ColorIB; } else if (High[0] >= High[1] && Low[0] >= Low[1]) { scenario = "2u"; scenarioBrush = ColorTrend; } else if (High[0] <= High[1] && Low[0] <= Low[1]) { scenario = "2d"; scenarioBrush = ColorTrend; } else if (High[0] > High[1] && Low[0] < Low[1]) { scenario = "3"; scenarioBrush = ColorOB; } return scenario; } [XmlIgnore] [ NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Color IB (1)", GroupName = "NinjaScriptParameters", Order = 0)] public SolidColorBrush ColorIB { get; set; } [XmlIgnore] [ NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Color Trend (2)", GroupName = "NinjaScriptParameters", Order = 0)] public SolidColorBrush ColorTrend { get; set; } [XmlIgnore] [ NinjaScriptProperty] [Display(ResourceType = typeof(Custom.Resource), Name = "Color OB (3)", GroupName = "NinjaScriptParameters", Order = 0)] public SolidColorBrush ColorOB { get; set; } }
Comment