Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop timer when switching workspaces

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

    Stop timer when switching workspaces

    Hello!

    I have a timer within an indicator. The challenge I'm having is when switching workspaces, I'm unsure how to stop / unregister the event handler. I don't see any state change being called. Therefore, the timer continues to run when it should not causing problems. Can you please tell me how to handle this?

    Thank you!

    #2
    Hello neo302,

    Thank you for your post.

    There is no supported way to programmatically access whether the workspace in which a script is applied is the active workspace or not. I have submitted this as a feature request to the Development Team. I will follow up with an internal tracking number for your reference as soon as it is created.

    With that said, there is an IsSuspendedWhileInactive property that will prevent OnBarUpdate() from being processed when an indicator's window/tab is not being used:


    With that in mind, I was able to find a property via the intelliprompt in the NinjaScript editor for this.Owner.IsActive. It is a bool that returns a value based on whether the window is active or not. This would, however, apply to more than just whether the workspace is active or not and would likely take into consideration whether the window is minimized or out of focus. Additionally, any unsupported code is subject to change at any time with any future releases of the platform and should be used at your own risk.

    I will follow up once I have the tracking number for the feature request. Thank you for your patience.

    Comment


      #3
      Originally posted by NinjaTrader_Emily View Post
      Hello neo302,

      Thank you for your post.

      There is no supported way to programmatically access whether the workspace in which a script is applied is the active workspace or not. I have submitted this as a feature request to the Development Team. I will follow up with an internal tracking number for your reference as soon as it is created.

      With that said, there is an IsSuspendedWhileInactive property that will prevent OnBarUpdate() from being processed when an indicator's window/tab is not being used:


      With that in mind, I was able to find a property via the intelliprompt in the NinjaScript editor for this.Owner.IsActive. It is a bool that returns a value based on whether the window is active or not. This would, however, apply to more than just whether the workspace is active or not and would likely take into consideration whether the window is minimized or out of focus. Additionally, any unsupported code is subject to change at any time with any future releases of the platform and should be used at your own risk.

      I will follow up once I have the tracking number for the feature request. Thank you for your patience.
      Thank you for the information Emily and for creating the feature request!

      Comment


        #4
        Hello neo302,

        Thanks for your patience.

        The internal tracking number for your feature request is SFT-6095. Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

        When a feature request is implemented, you'll find a description of the new feature in the release notes:Thank you for using NinjaTrader.​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        578 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X