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 Tim-c, Today, 10:58 AM
      0 responses
      1 view
      0 likes
      Last Post Tim-c
      by Tim-c
       
      Started by traderqz, Yesterday, 09:06 AM
      3 responses
      21 views
      0 likes
      Last Post NinjaTrader_ThomasC  
      Started by f.saeidi, Today, 10:19 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by kujista, Today, 06:23 AM
      5 responses
      18 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by traderqz, Today, 12:06 AM
      3 responses
      6 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X