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

Reading text file by multiple instances of indicator

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

    Reading text file by multiple instances of indicator

    Hello,

    I need to be able to read values from a text file into multiple instances of the same indicator on separate charts. For example pivot lines or support/ resistance lines.

    I know it is possible to read into an indicator and I have seen the StreamrReader examples, so my question really is about the multiple reads. Is it possible to do this or would the StreamReader not be able to open the file from the multiple instances? I am considering the case of when ninja starts up and the indicators go to access the file.

    If it needs to be linear access is there a way to do that?

    Thanks

    #2
    Hello Tasker-182,

    I have found a few stackoverflow threads that may help you to accomplish your goal.

    http://stackoverflow.com/questions/1...etween-threads

    http://stackoverflow.com/questions/1...ent-file-write

    I think it may be possible to save the values to static variables. I'm currently trying to test that theory. I will update you if I am successful.


    Please let me know if I can be of further assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Tasker-182 View Post
      Hello,

      I need to be able to read values from a text file into multiple instances of the same indicator on separate charts. For example pivot lines or support/ resistance lines.

      I know it is possible to read into an indicator and I have seen the StreamrReader examples, so my question really is about the multiple reads. Is it possible to do this or would the StreamReader not be able to open the file from the multiple instances? I am considering the case of when ninja starts up and the indicators go to access the file.

      If it needs to be linear access is there a way to do that?

      Thanks
      You just have to open the file for multiple read (ie., asynchronous) access.

      ref: http://msdn.microsoft.com/en-us/library/db5x7c0d.aspx

      Comment


        #4
        Thanks for the help.

        On a slightly related subject. How can I retain a user input filename and path (input via the indicator panel) so that it stays in the indicator after shutdown and is there on restart.

        Comment


          #5
          Originally posted by Tasker-182 View Post
          Thanks for the help.

          On a slightly related subject. How can I retain a user input filename and path (input via the indicator panel) so that it stays in the indicator after shutdown and is there on restart.
          That will be a string, so it is properly serialized by NT on its own. You should need to do nothing other than expose the Property as a public string.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,221 views
          0 likes
          Last Post xiinteractive  
          Started by andrewtrades, Today, 04:57 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          7 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          438 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          9 views
          0 likes
          Last Post FAQtrader  
          Working...
          X