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

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().
    BertrandNinjaTrader Customer Service

    Comment


      #3
      that did the trick,

      Thanks,
      Will.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by mattbsea, Today, 05:44 PM
      0 responses
      3 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      31 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      2 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,282 views
      0 likes
      Last Post Leafcutter  
      Started by WHICKED, Today, 12:45 PM
      2 responses
      20 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Working...
      X