I've configured some custom brushes in a script, but none of them are showing up in my chart when I'm connected to my broker and trading live. They worked in replay mode though. Here's what I have on the code side:
namespace NinjaTrader.NinjaScript.Strategies { public class Feb152024 : Strategy { (...) // Define all brushes here private Brush ENV_online; private Brush ENV_lowPower; private Brush ENV_offline; private Brush trendArrow_up_3; private Brush trendArrow_up_2; private Brush trendArrow_up_1; private Brush trendArrow_0; private Brush trendArrow_down_1; private Brush trendArrow_down_2; private Brush trendArrow_down_3; private Brush bidGap_firstGap_line; private Brush bidGap_secondGap_line; private Brush bidGap_thirdGap_line; private Brush askGap_firstGap_line; private Brush askGap_secondGap_line; private Brush askGap_thirdGap_line; (...) protected override void OnStateChange() { (...) else if (State == State.Configure) // Configure is called after a user adds an object to the applied list of objects. // • Add additional data series via AddDataSeries() // • Declare custom resources { // Configure the colors of the brushes in this space ENV_online = new SolidColorBrush(Color.FromArgb(255, 3, 3, 20)); ENV_online.Freeze(); ENV_lowPower = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); ENV_lowPower.Freeze(); ENV_offline = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); ENV_offline.Freeze(); trendArrow_up_3 = new SolidColorBrush(Color.FromArgb(255, 83, 58, 233)); trendArrow_up_3.Freeze(); trendArrow_up_2 = new SolidColorBrush(Color.FromArgb(255, 55, 38, 155)); trendArrow_up_2.Freeze(); trendArrow_up_1 = new SolidColorBrush(Color.FromArgb(255, 27, 19, 77)); trendArrow_up_1.Freeze(); trendArrow_0 = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); trendArrow_0.Freeze(); trendArrow_down_1 = new SolidColorBrush(Color.FromArgb(255, 55, 16, 65)); trendArrow_down_1.Freeze(); trendArrow_down_2 = new SolidColorBrush(Color.FromArgb(255, 110, 33, 130)); trendArrow_down_2.Freeze(); trendArrow_down_3 = new SolidColorBrush(Color.FromArgb(255, 166, 50, 195)); trendArrow_down_3.Freeze(); bidGap_firstGap_line = new SolidColorBrush(Color.FromArgb(150, 191, 0, 0)); bidGap_firstGap_line.Freeze(); bidGap_secondGap_line = new SolidColorBrush(Color.FromArgb(150, 128, 0, 0)); bidGap_secondGap_line.Freeze(); bidGap_thirdGap_line = new SolidColorBrush(Color.FromArgb(150, 64, 0, 0)); bidGap_thirdGap_line.Freeze(); askGap_firstGap_line = new SolidColorBrush(Color.FromArgb(150, 31, 198, 0)); askGap_firstGap_line.Freeze(); askGap_secondGap_line = new SolidColorBrush(Color.FromArgb(150, 8, 144, 0)); askGap_secondGap_line.Freeze(); askGap_thirdGap_line = new SolidColorBrush(Color.FromArgb(150, 10, 93, 0)); askGap_thirdGap_line.Freeze(); } (...) protected override void OnBarUpdate() { (...) // Color the background given the price span and gap target indicators if (gap_target_signal == "*" && price_span_signal == "*") { BackBrushes[0] = ENV_online; ENV_status = "Online"; } else if (gap_target_signal == "" && price_span_signal == "*") { BackBrushes[0] = Brushes.Black; ENV_status = "Low power"; } else if (gap_target_signal == "*" && price_span_signal == "") { BackBrushes[0] = Brushes.Black; ENV_status = "Low power"; } else { BackBrushes[0] = ENV_offline; ENV_status = "offline"; }
Any suggestions on how to trouble shoot this?
Comment