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

how to read environment variable or check for file existence

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

    how to read environment variable or check for file existence

    I'm looking for a way to display an alert on my charts if some necessary information in my overall trading environment (outside NT7) is faulty or missing.

    So,I would like to either read a Windows environment variable's value or check whether a specific file exists on my computer from within NT7 indicator code, Is one or the other possible, and if so, how?

    Thanks in advance for any advice

    #2
    Hello RonnyKeller,

    Thanks for writing in.

    While both approaches are equally possible in C#, we have reference sample code on using System.IO to be able to read and write to files. We don't have a reference sample for reading Windows environment variables.

    If you would like read a Windows environment variable , I would suggest checking out the MSDN documentation on Environment.GetEnvironmentVariable. Here is a link: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    If you would like to do this by file, I would suggest to have a look at our reference sample for reading and writing files when using System.IO. Here is a link as well: http://ninjatrader.com/support/forum...ead.php?t=3477

    Please let me know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks a lot, Jim - problem solved!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, 04-18-2024, 08:16 AM
      4 responses
      18 views
      0 likes
      Last Post trilliantrader  
      Started by mgco4you, Today, 09:46 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by wzgy0920, Today, 09:53 PM
      0 responses
      9 views
      0 likes
      Last Post wzgy0920  
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      10 views
      0 likes
      Last Post Rapine Heihei  
      Working...
      X