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

NT Loaded/Show

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

    NT Loaded/Show

    Hi,

    I am well aware that the following is not officially supported and likely will not get a response from the NT support staff, but I am asking in the hope that someone in the community may have some information that might help me.

    I have a piece of code that I need to execute once NT has loaded/enabled and rendered to the screen. I am aware that NT is likely a wpf STA thread application, likely using an automatically generated Main function. I have tried using Dispatcher.Invoke to execute my function and it works very nicely once NT is up and running (i.e. starting with a blank Workspace and just the Control Center window). However, and here is the issue, if I create a chart and save the workspace, and then relaunch NT, NT stalls. There are no error messages and nothing obviously wrong in the trace or log files. If I right click on the NT icon in the Windows taskbar a few times, it loads and works fine. It seems therefore that perhaps my code is somehow interfering in some way with MainWindow.Show() or the mechanism that renders the NT windows to the screen - the last bit before NT is ready to go. I am guessing here though.

    So, does anyone know if there is an event (or something) that I might be able to subscribe to (or check) that would tell me whether NT is loaded and enabled so that I might execute my code on that event? Alternatively, has anyone tried running custom code async, or on another thread, and having it interact with the UI once NT has rendered to the screen? Any insight would be greatly appreciated. Thank you.

    #2
    Hello Zeos6,

    Thanks for the post.

    For Addons, you have the OnWindowCreated function to check if the Control Center is open. Please see the attached example of a basic addon. For a .NET approach to this, you could query the System for all running processes the following public link describes this further.

    When I get a reference to a System.Diagnostics.Process, how can I know if a process is currently running?


    Please let me know if you have any questions.
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you very much ChrisL. I will check this out, and will let you know if this does the trick. Your help is much appreciated.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by love2code2trade, Yesterday, 01:45 PM
      4 responses
      28 views
      0 likes
      Last Post love2code2trade  
      Started by funk10101, Today, 09:43 PM
      0 responses
      7 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      45 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Working...
      X