Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

error message

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

    error message

    I am continuing this post from the general programing section of the blog because this is a NT7 issue.

    I have an indicator that stays on the chart for a minute or two and then goes away printing the following error message

    Error on calling 'OnBarUpdate' method for indicator 'myindicator' on bar 257: Object reference not set to an instance of an object.

    I have tracked it down to the following code highlighted in RED that is generating the error when dealing with several dataseries:
    protectedoverridevoid OnBarUpdate()
    {

    if (CurrentBar < 10) return;

    double YCES = Closes[1][1]; // Yesterday Close of ES
    double YCYM = Closes[2][1]; // Yesterday Close of YM



    The indicator will take hard values as follows and will not generate an error:


    double YCES = 1000; // Yesterday Close of ES
    double YCYM = 1000; // Yesterday Close of YM

    So where am I going wrong or is this a true bug?

    Thanks
    Last edited by velocity; 11-30-2009, 05:49 PM.

    #2
    Please post the complete stripped down version of the code that outlines the issue. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      protectedoverridevoid Initialize()
      {

      // current series-0 is default on chart = ES ##-## daily
      Add("ES ##-##", PeriodType.Day, 1); //dataseries 2
      Add("YM ##-##", PeriodType.Day, 1); //dataseries 3
      }

      protectedoverridevoid OnBarUpdate()
      {

      if (CurrentBar < 11) return;
      double YCES = Closes[1][1]; // Yesterday Close of ES
      double YCYM = Closes[2][1]; // Yesterday Close of YM
      }

      The strange thing about this is that when the market is closed the entire indicator works perfectly. It has all the right numbers and plots spot on.

      during the market hours if I hard wire a value into YCES and YCYM, the indicator will not vanish from the chart and all the bells and whistles I programed work just fine.

      any thoughts, I am using DTNIQ as my datafeed.

      Comment


        #4
        velocity,

        Do you have issues when using [0] index for the bar accessed?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I changed the code to:

          if (CurrentBar < 11) return;
          double YCES = Closes[1][0]; // Yesterday Close of ES
          double YCYM = Closes[2][0]; // Yesterday Close of YM
          }

          Also tried:

          if (CurrentBar < 11) return;
          double YCES = Closes[0][1]; // Yesterday Close of ES
          double YCYM = Closes[0][1]; // Yesterday Close of YM



          and I have the same problems, the indicator flashes on then off the chart.
          Last edited by velocity; 12-01-2009, 11:16 AM.

          Comment


            #6
            velocity,

            Situation begs a more simple question. Do you actually have data on all three instruments? Please try opening a daily chart of each one and ensure you actually have at least 20 days back on all three instruments used.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Josh,

              I ran a print on all three data series. What is happening is that when I reload indicator script data 0 series is correct for the first line. Then what happens is it automatically defaults to data series 2 all by itself.

              I truly believe there is an NT7 issue centered around a multiseries data indicator.

              Also, on the chart the data goes back 365 days, yet in the output window the data only shows for a few lines.

              Something is wrong here.

              Comment


                #8
                velocity,

                Please do a complete clean install of the new NT7B5 version and try the attached indicator. It works on my end with no problems.
                Attached Files
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Josh,

                  Your indicator is behaving the same as mine. If you add

                  Plot0.Set(YCES);

                  and set

                  CalculateOnBarClose = false;

                  The plot will come on the chart for a brief second and then dissappear.


                  Does the YCES and YCYM need to be converted to a dataseries for the CalculateOnBarClose = false; to display?



                  Thanks


                  Last edited by velocity; 12-03-2009, 05:28 PM.

                  Comment


                    #10
                    Josh,

                    Any thoughts on this?

                    I am still having issues here.

                    thanks

                    Comment


                      #11
                      Still investigating. Will get back to you at a later point in time. Thank you for your patience.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Josh,

                        Have you been able to duplicate this bug? Will it be fixed in the next release?

                        Thanks

                        Comment


                          #13
                          There may have been some changes around DataSeries objects which may have impact on this. On the latest sources I am not able to reproduce. Please try again on next version and let us know if you can reproduce.

                          Attached is a screenshot of running with CalculateOnBarClose = false and Plot0.Set(YCES) on a ES daily chart. Everything seems to be working correctly.
                          Attached Files
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Problem VS 2008 after clicking &quot;Start Debugging&quot;.

                            I've updated my NinjaTrader to latest version. When I click "Start Debugging" in Visual Studio, I get the following:

                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a 5c561934e089\mscorlib.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Program Files\NinjaTrader 6.5\bin\NinjaTrader.exe'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Program Files\NinjaTrader 6.5\bin\NinjaTrader.Core.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms \2.0.0.0__b77a5c561934e089\System.Windows.Forms.dl l'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a 5c561934e089\System.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0 .0__b03f5f7f11d50a3a\System.Drawing.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__ b77a5c561934e089\System.Xml.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Program Files\NinjaTrader 6.5\bin\WilsonORMapper.dll'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b 77a5c561934e089\System.Data.dll'
                            A first chance exception of type 'System.NullReferenceException' occurred in NinjaTrader.Core.dll
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration \2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dl l'
                            2009-12-18 11:14:02:859 ******************* Session Start (Version 6.5.1000.14) *******************
                            2009-12-18 11:14:02:859 Attaching global exception handlers...
                            2009-12-18 11:14:02:859 InstallDir='C:\Program Files\NinjaTrader 6.5\'
                            2009-12-18 11:14:02:859 UserDataDir='C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Management\2. 0.0.0__b03f5f7f11d50a3a\System.Management.dll'
                            The thread 0xc98 has exited with code 0 (0x0).
                            The thread 0xab4 has exited with code 0 (0x0).
                            The thread 0xb78 has exited with code 0 (0x0).
                            2009-12-18 11:14:04:140 Cbi.Globals.MachineId: True/True
                            2009-12-18 11:14:04:140 MachineId='82D8A7DD6A8D003C1243F53F4494A5E0'
                            2009-12-18 11:14:04:140 OS='Microsoft Windows NT 5.1.2600 Service Pack 3'/'Win32NT'
                            2009-12-18 11:14:04:140 ProcessorCount='2'
                            2009-12-18 11:14:04:140 .NET Version='2.0.50727.3603'
                            2009-12-18 11:14:04:140 Processor=' Intel(R) Pentium(R) 4 CPU 3.20GHz'
                            2009-12-18 11:14:04:140 PhysicalMemory=1024 MB
                            2009-12-18 11:14:04:140 Timezone=EST -1 hour(s)
                            2009-12-18 11:14:04:140 Creating file type watcher...
                            2009-12-18 11:14:04:156 Retrieving license...
                            2009-12-18 11:14:04:171 Cbi.Licence.Download5
                            A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
                            A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
                            'NinjaTrader.exe' (Managed): Loaded 'jfqsur_8'
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Program Files\NinjaTrader 6.5\bin\SMTP.Net.dll'
                            2009-12-18 11:14:05:031 Cbi.Licence.ProcessLicense13
                            2009-12-18 11:14:05:031 Cbi.Licence.Download99: 'Type=SimulationOnly State=Verified StartDate=5/1/2006 EndDate=12/30/2099 Collective2 Dtn ESignal External OpenTick Provider2 Replay Simulator Yahoo Gain Hosted AdvancedStrategyManagement AutomatedTrading BasicEntry Charting DataConnection SuperDom'
                            2009-12-18 11:14:05:031 Starting splash...
                            2009-12-18 11:14:05:234 Copying custom DLLs...
                            2009-12-18 11:14:05:234 Running Cbi.Globals.Install()...
                            2009-12-18 11:14:05:250 WARNING: Session Break (Version 6.5.1000.14)
                            2009-12-18 11:14:05:250 Loading server side config file...
                            2009-12-18 11:14:05:500 Clearing C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\bin\Custom\Tmp...
                            2009-12-18 11:14:05:500 Loading C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\bin\Custom\NinjaTrader.Custom.dll...
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\bin\Custom\NinjaTrader.Custom.dll'
                            2009-12-18 11:14:05:562 Loading C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\bin\Custom\NinjaTrader.Vendor.dll...
                            'NinjaTrader.exe' (Managed): Loaded 'C:\Documents and Settings\Scott\My Documents\NinjaTrader 6.5\bin\Custom\NinjaTrader.Vendor.dll'
                            2009-12-18 11:14:05:578 Creating user defined methods files...
                            2009-12-18 11:14:05:578 Instantiating serializers...

                            Comment


                              #15
                              aascotty,

                              I responded to your email with this same question. We would appreciate it if you could post 6.5 questions to a new thread outside of the NT7 beta section here. Thank you.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              607 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              353 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              560 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              561 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X