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

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.
    JesseNinjaTrader Customer Service

    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 bortz, 11-06-2023, 08:04 AM
        47 responses
        1,610 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        16 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X