Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing the active workspace name

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

    Accessing the active workspace name

    Hi,

    What is the best way to access the active NT workspace name in an addon that inherits from AddOnBase?

    I've been using WorkspaceOptions.GetActiveWorkspaceFromXml are there other ways?

    Thanks,
    Nick

    Last edited by NickyD; 03-23-2022, 03:17 PM.

    #2
    Hello NickyD,

    That would be the only way that I am aware of however that is not currently a documented method. I would be unable to say what the overall expectation is for that method to know if what you tried was valid or not. If you have a sample of what you tried and it is not working in some way I could take a look to get a better idea if that may be expected in the specific use case. I would need to know the specific steps you used.

    Comment


      #3
      I was looking at WorkspaceOptions.GetActiveWorkspaceFromXml during OnWindowCreated, but I think OnWindowCreated is getting invoked far more than I realized and in a sequence I was not expecting when switching back and forth between workspaces (it seems to be invoked on the workspace I was closing/switching off of). So I don't think I was always getting the correct context I wanted because I wasn't handling the logic correctly.


      Shortly after I made the post, I of course stumbled across this:

      Code:
      // the main chart window
      chartWindow = window as Gui.Chart.Chart;
      
      // if not a chart, do nothing
      if (chartWindow == null) {
      Print("chartWindow null");
      return;
      }
      
      [B]chartWindow.GetWorkspaceName()  [/B]
      This is working better for me, so I am going with it for the time being.

      Thanks.

      Comment


        #4
        I would suggest using WorkspaceOptions.GetActiveWorkspaceFromXml as it is not dependent on a particular type of window. It works in Strategies and AddOns. Haven't tried it in Indicators, but I expect it would work there too.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        42 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        29 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        46 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X