Chart bars changing colors unexpectedly

I’m hoping some long-term Ninjatrader users can advise

Lately I’ve been using non-default bar colors for some testing a new indicator. I keep the bars black & white so that I can see easily what the indicators is doing. I load a chart template with these colors.

The issue I have is that sometimes… not every time… when I switch timeframe or instrument, the bars go back to the default green/red… Like awful green/red - even the wicks are green/red, there’s no border on the bars and the bars are too thin as well.

It is driving me nuts and causing me a lot of wasted time. Either setting the chart up from scratch again or manually fixing the bar colors.

Any idea how to stop this happening?

1 Like

if you are switching to a different timeframe, there may be a different default that is being used. I notice for me, I have different settings depending on if it is a seconds chart, vs minute. If you use Ctrl+F that will bring up the window for the chart and you can select the timeframe and bar colors and width. If you like the settings you are using I would save them as the default template for those timeframes.

Since you are testing a new indicator, I would split the template/default check from a possible script override.

  1. Duplicate the chart for testing, remove the new indicator, keep the same black/white template, and repeat the exact instrument/timeframe switch that caused the reset.
  2. If the colors now stay put, add only that indicator back and repeat. In source you are allowed to inspect, check BarBrush/BarBrushes and CandleOutlineBrush/CandleOutlineBrushes, including any initialization that changes chart settings. This is a diagnostic split, not proof that the indicator is at fault.
  3. If it also happens without the indicator, compare the Data Series bar style, width and color settings before/after the switch, as Rockmanx00 suggested. The width and border changes make that comparison useful too.

NinjaTrader documents BarBrush as a body-color override, with null returning that bar to its chart default: NinjaScript > Language Reference > Common > Drawing > BarBrush . CandleOutlineBrush controls the candle outline: NinjaScript > Language Reference > Common > Drawing > CandleOutlineBrush .

Does the same switch reproduce on the duplicate chart with the new indicator removed?

This started happening when I switched to 8.1.6.3.
The bar color change happens after a new indicator is compiled.
For me it’s usually a historical data reload after a compile.

Save a chart template for each chart.
When the bar color change occurs, load the chart templates to get back to normal.

This was the answer - it is caused by a Ninjascript recompile.

And I’m also on 8.1.6.3 which is the last rock-solid stable release I know of.

I could not find any way around it, but I’ve changed the default colours on the stock Ninjatrader candle style, so they go to my defaults rather than the horrendous green/red ones.