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 proptradingshop, Today, 10:07 AM
          2 responses
          5 views
          0 likes
          Last Post proptradingshop  
          Started by sofortune, Today, 10:28 AM
          0 responses
          1 view
          0 likes
          Last Post sofortune  
          Started by marcus2300, Today, 10:21 AM
          1 response
          1 view
          0 likes
          Last Post marcus2300  
          Started by DawnTreader, 05-08-2024, 05:58 PM
          10 responses
          39 views
          0 likes
          Last Post DawnTreader  
          Started by gaz0001, Today, 10:09 AM
          0 responses
          2 views
          0 likes
          Last Post gaz0001
          by gaz0001
           
          Working...
          X