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

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 helpwanted, Today, 03:06 AM
          0 responses
          3 views
          0 likes
          Last Post helpwanted  
          Started by Brevo, Today, 01:45 AM
          0 responses
          6 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          5 views
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          242 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          384 views
          1 like
          Last Post Gavini
          by Gavini
           
          Working...
          X