Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ERROR: Failed to call method 'Initialize' for indicator

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

    ERROR: Failed to call method 'Initialize' for indicator

    What does this mean? YRecent is an indicator I developed myself, but I'm currently not using it on any charts... but this always shows up in my logs:

    2009-12-06 16:42:50:421 ERROR: Failed to call method 'Initialize' for indicator 'YRecent': Object reference not set to an instance of an object.
    2009-12-06 16:44:33:296 ERROR: Failed to call method 'Initialize' for indicator 'YRecent': Object reference not set to an instance of an object.
    2009-12-06 17:14:49:265 ERROR: Failed to call method 'Initialize' for indicator 'YRecent': Object reference not set to an instance of an object.
    2009-12-06 17:22:18:734 ERROR: Failed to call method 'Initialize' for indicator 'YRecent': Object reference not set to an instance of an object.
    2009-12-06 17:23:08:718 ERROR: Failed to call method 'Initialize' for indicator 'YRecent': Object reference not set to an instance of an object.

    How do I fix it?

    #2
    NinjaCustomer, expected - since the Initialize() is called each time across studies, you could comment out the part giving you the issue or debug the script -

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      NinjaCustomer, expected - since the Initialize() is called each time across studies, you could comment out the part giving you the issue or debug the script -

      http://www.ninjatrader-support2.com/...ead.php?t=3418
      just so you know, my indicator works fine and compiles fine...

      it is just that i get this error message in the log...

      could this be the culprit? I have this code in Initialize:

      new DataSeries(this);

      Comment


        #4
        Yes, as this alone is not a fully assigned DataSeries object - http://www.ninjatrader-support.com/H...iesObject.html

        Comment


          #5
          so what should I do?

          I see no difference between my code and what you have in the Help documentation link you gave me, so do I just ignore this error message? it is harmless?

          Comment


            #6
            btw. that was just a code fragment, of course I assigned it to a variable

            Comment


              #7
              You want to assign to a data series variable created in the variables section of your code -

              Code:
               
              protected override void Initialize() 
              { 
                  myDataSeries = new DataSeries(this); 
              }

              Comment


                #8
                Please post your full Initialize() then, thanks.

                Comment


                  #9
                  just remember when reading the code, that everything works as I intended in the indicator... it is only those log error messages that make me concerned that i am writing sloppy code... i just want to rule out that my indicator could cause any instability (because of those error messages):

                  Code:
                          protected override void Initialize()
                          {
                              
                  			lastHighCache = new ArrayList();
                  			lastLowCache = new ArrayList();
                  
                  			swingHighSeries	= new DataSeries(this);
                  			swingHighSwings	= new DataSeries(this);
                  			swingLowSeries	= new DataSeries(this);
                  			swingLowSwings	= new DataSeries(this);
                  
                  			prevSwingRange = -1;
                  			
                  			BarsRequired = 100;
                  			
                  			AutoScale           = false;
                  			DisplayInDataBox	= false;
                              CalculateOnBarClose	= true;
                  			PaintPriceMarkers	= false;
                              Overlay				= true;
                  			
                  			ActiveMarketLogFile = Environment.GetFolderPath(Environment.SpecialFolder.Personal) +
                  	                                    @"\misc\" + Instrument.MasterInstrument.Name + "_active_market_alerts.csv";
                  			
                  			if (logActiveMarketAlerts) File.Delete(ActiveMarketLogFile);
                          }

                  Comment


                    #10
                    Please move the log file calls accessing the Instrument to the first OnBarUpdate() bar and then retry.

                    Comment


                      #11
                      so I should just put it in a

                      if (CurrentBar == 0) {

                      }

                      in OnBarUpdate ?

                      Comment


                        #12
                        Yes, as the Instrument would likely be emtpy (null) if not placed there...

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        606 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