All works lovely but I have come across an issue I simply don't understand.
In the IsFirstTickOf bar I set brushes like so just for past bars ie[1][2], etc
CurrentBar is updated real time in OnBarUpdate below
if(IsFirstTickOfBar) { ChartControl.Dispatcher.InvokeAsync((Action)(() => { if(myStringSeries != null) myBrush1 = (System.Windows.Media.SolidColorBrush)new BrushConverter().ConvertFromString(myStringSeries[1]);//CurrentBar forces error myBrush2 = (System.Windows.Media.SolidColorBrush)new BrushConverter().ConvertFromString(myStringSeries[2]); })); }
if(Close[0] < Open[0]) { temp = Brushes.Red; myStringSeries[0] = temp } //Convert current bar colour to a SolidColorBrush to be used in OnRender - has to be done in it's own thread otherwise it throws errors ChartControl.Dispatcher.InvokeAsync((Action)(() => { myBrush0 = (System.Windows.Media.SolidColorBrush)new BrushConverter().ConvertFromString(temp.ToString()); })); if(myStringSeries != null) { //CC is just a method to take the hex code and turn it into "Red,Blue", etc Draw.TextFixed(this,"DKDK",CC(temp.ToString())+"\n"+ CC(myStringSeries[1])+"\n"+ CC(myStringSeries[2])// requires a null test ,TextPosition.TopLeft);// }
MyBrushes however have completely different values. CurrentBar value however is always correct. So It's something to do with the StringSeries but it has beaten me what it might be.
Can anyone shine a light as to where I am going wrong?
Comment