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 algospoke, Yesterday, 06:40 PM
      2 responses
      21 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      21 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X