I have an error in some custom code that is proving difficult to locate. I would appreciate it if someone might be able to shed any light on what exactly, '.<OnBarUpdate>d__49.MoveNext()' is likely to be related to so I can debug further.
The issue I have is that this ONLY ever occurs when Ninjatrader is starting up. Never at any time when running. It produces an error thus, from the trace log
2022-05-17 18:09:01:203 *************** unhandled exception trapped ***************
2022-05-17 18:09:01:203 Object reference not set to an instance of an object.
2022-05-17 18:09:01:203 System.NullReferenceException: Object reference not set to an instance of an object.
at NinjaTrader.NinjaScript.Indicators.mycustomcode. <OnBarUpdate>d__49.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatch Info.Throw()
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System. Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
2022-05-17 18:09:01:239 ERROR: Indicator '': Error on calling 'OnBarUpdate' method on bar 886: Object reference not set to an instance of an object.
and crashes out completely. There is never any chance to debug, even with visual studio. This will happen maybe 2/3 times in a row when starting NT8 (latest build and earlier) on occasion, then, just go away and not happen again for a time.
'MoveNext' is not a function in my code, so I am wondering if you might shed any light on what this might be related to so I can investigate further. Thanks.
Comment