Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue Overriding OnConnectionStatusUpdate in AddOnBase Class

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

    Issue Overriding OnConnectionStatusUpdate in AddOnBase Class

    Hello NinjaTrader Support,

    I am currently developing an add-on for NinjaTrader and have encountered an issue with extending functionality related to connection status updates. I am using NinjaTrader 8 and my class is derived from NinjaTrader.NinjaScript.AddOnBase. Here is the class definition:
    Code:
    public class MyClass : NinjaTrader.NinjaScript.AddOnBase {
        protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate) { // Intended implementation }
    }
    When I try to override the OnConnectionStatusUpdate method to handle connection status changes, I receive the following compiler error:

    CS0115 'MyClass.OnConnectionStatusUpdate(ConnectionStatus EventArgs)': no suitable method found to override

    This suggests that the OnConnectionStatusUpdate method is not available for overriding in the AddOnBase class. My goal is to efficiently manage connection status changes to subscribe and unsubscribe from order updates dynamically within my add-on.​

    Questions:
    1. Is it possible to override the OnConnectionStatusUpdate method in a class derived from AddOnBase? If not, what would be the recommended approach to handle connection status changes within an add-on?
    2. If overriding this method is not feasible within AddOnBase, could I potentially implement this functionality by creating an indicator or another support class specifically for handling these events? How would I integrate such a class with my add-on to manage connection-related actions?

    It’s imperative for the functionality of my add-on to react to connection status updates, so any guidance on how to achieve this within the NinjaTrader framework would be greatly appreciated.

    Thank you for your assistance.

    Best regards,
    ​ Aviram Y.
    Aviram Y
    NinjaTrader Ecosystem Vendor - Aviram Y

    #2
    Update:
    I've tried using an indicator, it doesn't work since it needs to be attached to a chart.

    I would still like to know if there's a way to implement the above but:

    For anyone interested, I've found a workaround by subscribing to all trading related buttons, creating a reference class to hold accounts that already have some handler attached to them like OnOrderUpdate or anything else you desire in a dictionary containing the account as key and bool as value, then every PreviewMouseDown/PreviewKeyDown invocation i get the account to be manipulated via code and check if a handler has already been attached using the reference class..


    Aviram Y
    NinjaTrader Ecosystem Vendor - Aviram Y

    Comment


      #3
      Hello Aviram Y,

      Addons do not have any of the overriding methods that you find in indicators or strategies, you would need to work directly with the account in an addon. You can see an example of finding an account and subscribing to its events here:




      Comment

      Latest Posts

      Collapse

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