-------here in OnRender()--------------
if (Position.MarketPosition != MarketPosition.Flat && !isPositionClosedXSendToMarket && chartTraderSL.Count > 0)
TriggerCustomEvent(o =>
{
foreach (var item in chartTraderSL.ToArray())
[COLOR=#e74c3c]DrawOrderLineSL[/COLOR](item.Value.Order, chartControl, chartScale, item.Key, item.Value.OpenLoss, item.Value.TickValue);
}, null);
---------here in [COLOR=#e74c3c]DrawOrderLineSL[/COLOR]---------
var newValueWidth = new StopLoss { OrderLabelLayoutWidth = rectTextOrderLabelSL.Width + rectQtyOrderLabelSL.Width};
chartTraderSL.AddOrUpdate(orderId, newValueWidth, (key, oldValueWidth) =>
{
if (newValueWidth.OrderLabelLayoutWidth != oldValueWidth.OrderLabelLayoutWidth)
oldValueWidth.OrderLabelLayoutWidth = newValueWidth.OrderLabelLayoutWidth;
return oldValueWidth;
});
04.03.2021 09:27:34:000 > [SidiSystemBase][DrawOrderLineSL]-[ERROR]-System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei NinjaTrader.NinjaScript.Strategies.StopLoss.Equals (StopLoss other)
bei System.Collections.Generic.GenericEqualityComparer `1.Equals(T x, T y)
bei System.Collections.Concurrent.ConcurrentDictionary `2.TryUpdate(TKey key, TValue newValue, TValue comparisonValue)
bei System.Collections.Concurrent.ConcurrentDictionary `2.AddOrUpdate(TKey key, TValue addValue, Func`3 updateValueFactory)
bei NinjaTrader.NinjaScript.Strategies.SidiSystemBase. DrawOrderLineSL(Order order, ChartControl chartControl, ChartScale chartScale, String orderId, Double openProfit, Double tickValue)

Comment