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 yertle, Today, 08:38 AM
      3 responses
      10 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
      80 responses
      19,667 views
      5 likes
      Last Post NinjaTrader_ChelseaB  
      Started by adeelshahzad, Today, 03:54 AM
      2 responses
      16 views
      0 likes
      Last Post adeelshahzad  
      Started by dappa, Today, 09:18 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by bill2023, Yesterday, 08:51 AM
      5 responses
      27 views
      0 likes
      Last Post bltdavid  
      Working...
      X