Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 lorem, 04-25-2024, 09:18 AM
              15 responses
              64 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by doihaveto13, Today, 12:46 PM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Started by owen5819, 05-11-2024, 02:24 PM
              3 responses
              20 views
              0 likes
              Last Post owen5819  
              Started by Vitamite, Today, 12:48 PM
              0 responses
              6 views
              0 likes
              Last Post Vitamite  
              Started by MrAdamSK, 04-02-2024, 11:25 PM
              3 responses
              41 views
              0 likes
              Last Post NinjaTrader_Zachary  
              Working...
              X