Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Object reference not set to an instance of an object

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Object reference not set to an instance of an object

    I am testing a new strategy. It backtests fine, but when I attempt to click on any tab other than Summary, NT crashes and the following is posted to the trace file:

    2009-09-10 10:43:38:890 in OnUnhandledThreadException
    2009-09-10 10:43:38:890 ********* exception trapped *********
    2009-09-10 10:43:38:890 Object reference not set to an instance of an object.
    2009-09-10 10:43:38:890 at NinjaTrader.Strategy.StrategyBase.AddAllExecutions (Position position, Execution execution, Order order, Boolean setExitEntry, Boolean setStopLoss, Boolean pooled)
    at NinjaTrader.Gui.PerformanceViewerControl.RunBackTe st()
    at NinjaTrader.Gui.PerformanceViewerControl.Display()
    at NinjaTrader.Gui.PerformanceViewerControl.OnTabSele cted(Object sender, EventArgs e)
    at System.EventHandler.Invoke(Object sender, EventArgs e)
    at System.Windows.Forms.TabControl.OnSelectedIndexCha nged(EventArgs e)
    at System.Windows.Forms.TabControl.WmSelChange()
    at System.Windows.Forms.TabControl.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



    What am I doing wrong?

    #2
    jh1962,

    Would not know without code. I suggest you try to strip down your code to its basics. See if that works. Then slowly layer on complexity till you find the segment that breaks. Then we can help you analyze why such a code segment would cause this.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thanks for the quick response. The code is exceedingly simple. And as I said, the problem isn't that the backtest doesn't run - it does. But when I click on any tab other than "Summary", it crashes. I get a full summary, but I cannot look at trades, executions, charts, graphs, etc.

      Ideas?

      Comment


        #4
        Please try with SampleMACrossOver strategy and see if the same happens.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Sample works fine. I commented out everything until the problem went away. Had to restart NT each and every time. This is apparently the line causing the problem:

          Add("ZB 09-09", PeriodType.Minute, 10);

          Advice?

          That line is (was) in the Initialize() method

          Comment


            #6
            So a simple strategy with no logic in OnBarUpdate() with only that line in Initialize() causes you the crash? What version of NT are you on? Can you pull up a chart of this instrument with no problem?
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              I am hitting this problem as well with NT7. I will do more homework to confirm. Just came across this.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              649 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              573 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              576 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X