Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

failed to call method 'initialize' for indicator

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

    failed to call method 'initialize' for indicator

    I get this message in the log, I am not running this indicator, it appears when i start one of my own, I did however take some code from it, but only from a section of code that was relevant

    failed to call method 'initialize' for indicator 'DOM_Bands': Object reference not set to an instance of the object.

    How can i track down this error and remove it?

    #2
    Hi tinkerz,

    Thank you for your post.

    It sounds like the new indicator is referencing the DOM_Bands.

    Can you reply with the code under Initialize() in the DOM_Bands?
    TimNinjaTrader Customer Service

    Comment


      #3
      Code:
              protected override void Initialize()
              {
                  
                  Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Bar, "BidAmp"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Bar, "SellAmp"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.DarkViolet), PlotStyle.Bar, "AskAmp"));
                  Add(new Plot(Color.FromKnownColor(KnownColor.Firebrick), PlotStyle.Bar, "BuyAmp"));
                  CalculateOnBarClose    = false;
                  Overlay                = false;
                  PriceTypeSupported    = false;
      //The input time-series Excel range. Length must be a power of 2 (for example 16, 32, 64, 128 etc…).            
                  BuyStack = new Queue(128);
                  BuyTime = new Queue(128);
                  BuyArray = new double[128];
                   BuyTimeArray= new double[128];
                  
                  AskStack = new Queue(128);
                  AskTime = new Queue(128);
                  AskArray = new double[128];
                   AskTimeArray= new double[128];
                  
                  BidStack = new Queue(128);    
                  BidTime = new Queue(128);
                  BidArray = new double[128];
                   BidTimeArray= new double[128];            
                  
                  SellStack = new Queue(128);
          
                  
                  timestart = (DateTime.Now.AddMilliseconds(100).TimeOfDay.TotalSeconds);
                  
                  _hp = new double[129];
                  _smoothHp = new double[128];
                  DrawOnPricePanel = false;
              }

      Comment


        #4
        Hi tinkerz,

        Likely, some of the assignments in the initialize need to be moved to the OnBarUpdate() section of the code, specifically, any that result in an empty object.

        You can have them called on the first bar with

        if (CurrentBar == 0)
        {
        replace here
        }

        If you don't use the indicator, you may be able to simply delete it or comment out the problematic sections.
        TimNinjaTrader Customer Service

        Comment


          #5
          OK Its the DOM_bands that is problem, that initialize section was from my indicator i copied functions too, ok i will look at dom bands

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          152 views
          1 like
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          87 views
          1 like
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          131 views
          2 likes
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          127 views
          1 like
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          106 views
          0 likes
          Last Post CarlTrading  
          Working...
          X