BackBrush color change prevents compiling

Using Strategy Builder BackBrush, i am trying to set the charts background color when certain conditions are met. The strategy compilies correctly and works with the default color. However once i try to change the color it no longer compiles.
Why should the color selection impact its ability to compile?

Same behavior for BackBrushAll.

Further examination reveals the errors occur when the newly selected color does not resolve into a “named” color. Previously colors where all named. A recent ninjatrader update has changed color selection now providing many more colors, most of which are identified by a code. These colors with only a code id do not compile. If however a color is selected that resolved to a “named” color then it will compile correctly.

This is a bug that should be fixed or revert to the previous method of managing colors.

Until the Builder output is fixed, a workaround: pick a color that resolves to a named brush, or click Unlock Code and set the brush yourself. Create it once in State.DataLoaded and freeze it, then assign it in OnBarUpdate:

myBrush = new SolidColorBrush(Color.FromRgb(30, 30, 60)); myBrush.Freeze();

BackBrush = myBrush;

Freezing matters because NinjaTrader renders on another thread, and an unfrozen custom brush can throw errors later. Once unlocked, the Builder can no longer edit the strategy, so keep a copy of the Builder version. Worth reporting the code-only colors to NinjaTrader support so they fix the generator. Happy to help further, feel free to DM me.