For some reason if I remove that flag in IF statement the bar colors correctly but then it colors all the bars after that signal as well and adds the text BUT I just want to get the first instance of signal - color the bar and add the text and then remove the signal so it just does the first bar that got triggered and none of the other bars after that even if it follows the same signal.
What is happening though is IF I set the signal to false after coloring the bars and adding the text it will only add the text but not color the bar. WHY?
I even did a print statement after setting the barColor and setting the flag to false and shows the right color for the bar but what is printed is not the right color on the chart.
if (over) { BarBrush = Brushes.White; CandleOutlineBrush = Brushes.White; if(EMA1.EmaClose[0] > VWAP[0]) { secondary = false; } if(secondary && High[0] < VMA1[0] ) { BarBrush = Brushes.Purple; CandleOutlineBrush = Brushes.White; Draw.Text(this, "secondary" + Close[0], false, "Arming", 0, Low[0] - 10, 0, Brushes.Cyan, new NinjaTrader.Gui.Tools.SimpleFont("Courier New", 20) {Bold = true }, TextAlignment.Center, null, Brushes.Black, 100); secondary = false; Print("Color: " + BarBrush); } }
Comment