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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      166 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      321 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      246 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X