One of the conditions is based on where the bar closes - so on that final tick when the bar actually closes, sometimes the conditions are no longer met, but the bar remains white. I don't want that. I want it to go back to being a normal bar, and to remove my target and stop dots, if the actual bar close doesn't meet my criteria.
I hope that makes sense.
Here's the code:
// Condition set 1
if (conditions for long signal)
{
BarColor = Color.White;
DrawDot("Target" + CurrentBar, false, 0, Close[0] + Target * TickSize, Color.Lime);
DrawDot("Stop" + CurrentBar, false, 0, Close[0] - Stop * TickSize, Color.Red);
Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go long", AlertSound, 2, Color.Black, Color.Yellow);
}
// Condition set 2
if (conditions for short signal)
{
BarColor = Color.White;
DrawDot("Stop" + CurrentBar, false, 0, Close[0] + Stop * TickSize, Color.Red);
DrawDot("Target" + CurrentBar, false, 0, Close[0] - Target * TickSize, Color.Lime);
Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Go short", AlertSound, 2, Color.Black, Color.Yellow);
}
Thanks for your help.
Comment