I've run into situations where this error gets logged, which necessitates ending the NT8 proccess via Task Manager:
Source: SharpDX.Direct2D1
StackTrace: at SharpDX.Direct2D1.RenderTarget.DrawLine(Vector2 point0, Vector2 point1, Brush brush, Single strokeWidth, StrokeStyle strokeStyle)
at NinjaTrader.NinjaScript.Indicators.gws.gBarVP.OnRe nder(ChartControl chartControl, ChartScale chartScale)
TargetSite: Void DrawLine(SharpDX.Vector2, SharpDX.Vector2, SharpDX.Direct2D1.Brush, Single, SharpDX.Direct2D1.StrokeStyle)
ChartBars: (Base 1-Tick) MinuteBarsType (Minute: 405/4) TickReplay OnEachTick
My solution was to move the brush and strokestyle object declarations up to the class scope and then dispose of them when State.Terminated. So far, this seems to have eliminated the external component exception.
I'm wondering if it's necessary at all to dispose of these objects and, if so, is it better to keep on reusing them without disposing until State.Terminated.
Comment