Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with unsupported function - Toolstrip buttons causing Initialise() to fail

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

    Help with unsupported function - Toolstrip buttons causing Initialise() to fail

    Hi, I am using some code from the unsupported thread to add buttons to my indicator in the toolstrip.

    The code I am using is

    in variables section

    private System.Windows.Forms.Control[] controls = null;

    in Initialize()

    controls = ChartControl.Controls.Find("tsrTool", false);

    The line in Initialize() causes the error below, but it only does it when I open the input parameters dialogue, and also when NT starts up. if I just reloadallninjascript that code executes without an error.

    error - Failed to call method 'Initialize' for indicator 'myIndicator': Object reference not set to an instance of an object.

    Can anyone offer any advice?

    Thanks,
    Will.

    #2
    Will, as the Initialize() could be called multiple times, I would look into moving that part to OnStartUp() instead. This will only be called once before the first OnBarUpdate().

    Comment


      #3
      that did the trick,

      Thanks,
      Will.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X