I'm getting the "Unhandled exception: Write lock may not be acquired with read lock held" and my chart freezes NT8.
I asked ChatGPT about this and it suggests the following:
else if (State == State.Configure) { Brush1 = new SolidColorBrush((Color)ColorConverter.ConvertFromS tring("#FF1B1B1B")); Brush1.Freeze(); Brush2 = new SolidColorBrush((Color)ColorConverter.ConvertFromS tring("#FF403F45")); Brush2.Freeze(); NoTradeBrush =new SolidColorBrush(Color.FromRgb(64,64,64)); //NoTradeBrush =new SolidColorBrush(Color.FromRgb(74,75,79)); NoTradeBrush.Freeze(); ShortBrush = new SolidColorBrush(Color.FromRgb(82,0,0)); ShortBrush.Freeze(); //AddDataSeries("ES 12-22", Data.BarsPeriodType.Range, 4, Data.MarketDataType.Last); AddDataSeries("",Data.BarsPeriodType.Range, 4, Data.MarketDataType.Last); EMA1 = EMA(Close, EMAPeriod); EMA2 = EMASecondarySeries(Close,5,4); SMA1 = SMA(EMA1, SMAPeriod); emaRange = EMASecondarySeries(EMAPeriod,RangePeriod); smaRange = SMA(emaRange, SMAPeriod); myTrendLine = AuEMA(Close, PeriodVWMA); DynSR = DynamicSR(Close, PeriodoDynSR); mad = aslMADifference(EMAPeriod,SMAPeriod,SepCorta); kama = KAMA(BarsArray[1],Fast, KPeriod, Slow); sw = Swing(mad,3); mk1 = MomentumKamaRp(Fast,KPeriod,Slow,MomPeriod,mk1Cota ); mkr4 = rpKamaRange2Series(Fast,KPeriod,Slow,MomPeriod,KRa ngePeriod, mkr4Cota); mer4 = MomentumSeries2(EMA2); chopbox = CongestionBoxSecondarySeries(BoxOpacity, BoxOpacity, BoxOpacity, RangePeriod,2); atrC = ATRCongestion( SWPeriod, MxMnPeriod, ATRLength, ATRMultiplier,ATRPrints); AddPlot(new Stroke() { Brush = Brushes.Transparent }, PlotStyle.Dot, "IntheboxPlot"); AddPlot(new Stroke() { Brush = Brushes.Transparent }, PlotStyle.Dot, "CongestionPlot"); }
Thank you
Bob
Comment