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, 04-17-2024, 06:40 PM
      5 responses
      46 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by arvidvanstaey, Today, 02:19 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by mmckinnm, Today, 01:34 PM
      3 responses
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by f.saeidi, Today, 01:32 PM
      2 responses
      8 views
      0 likes
      Last Post f.saeidi  
      Started by alifarahani, 04-19-2024, 09:40 AM
      9 responses
      55 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X