Color gradient_1 = pine.color.from_gradient(sosc[0], -100, 100, pine.color.from_brush(DownColor), pine.color.from_brush(UpColor)); Brush myBrush = new SolidColorBrush(gradient_1); myBrush.Freeze(); PlotBrushes[0][0] = myBrush;
color.from_brush returns a Color object from a Brush object
those are not important as those work as intended still.
what is important is that this worked in the previous version, but after I manually updated to 8.1 it stopped working
now it just applies the same color for the whole plot length, and the color used is the first color ever that was applied.
I've made a little sample to test and it seems when defining a new Brush inside the code, PlotBrushes will always be the first color your custom Brush was.
Brush myBrush = new SolidColorBrush(CurrentBar % 2 == 0 ? Color.FromRgb(255, 0, 0) : Color.FromRgb(0, 255, 0)); myBrush.Freeze(); Print(Time[0].ToString() + ": " + myBrush.ToString()); PlotBrushes[0][0] = myBrush;
27.3.2023. 15:25:00: #FF00FF00
27.3.2023. 15:30:00: #FFFF0000
27.3.2023. 15:35:00: #FF00FF00
27.3.2023. 15:40:00: #FFFF0000
27.3.2023. 15:45:00: #FF00FF00
27.3.2023. 15:50:00: #FFFF0000
as it should, the Brush object has the correct color inside.
but the whole plot is just green
but if I do
PlotBrushes[0][0] = CurrentBar % 2 == 0 ? Brushes.Red : Brushes.Lime;
This has to be a bug, right?
I've included an indicator file that has the above-mentioned simplified code and nothing else to showcase that it doesn't work.

Comment