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 DanielTynera, Today, 01:14 AM
        0 responses
        2 views
        0 likes
        Last Post DanielTynera  
        Started by yertle, 04-18-2024, 08:38 AM
        9 responses
        40 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by techgetgame, Yesterday, 11:42 PM
        0 responses
        11 views
        0 likes
        Last Post techgetgame  
        Started by sephichapdson, Yesterday, 11:36 PM
        0 responses
        2 views
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,615 views
        0 likes
        Last Post aligator  
        Working...
        X