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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      43 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      68 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      56 views
      0 likes
      Last Post CarlTrading  
      Working...
      X