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 adeelshahzad, Today, 03:54 AM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by RookieTrader, Today, 07:41 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by kujista, Today, 05:44 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by elderan, Yesterday, 08:03 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by samish18, Yesterday, 08:57 AM
      8 responses
      25 views
      0 likes
      Last Post samish18  
      Working...
      X