Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Editing Data in Running NT Scripts

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

    Editing Data in Running NT Scripts

    Looking for ideas that I can further develop to change data in a running script (without reloading).

    The simplest way appears to be for the user to edit values in a text file and then have the running script read this file and use the data?

    but I'd like to explore more sophisticated solutions. Before I start learning more about "Creating Your Own AddOn Window" and "Creating Chart WPF"

    do you think they will also offer any opportunities?

    #2
    Hello fingers,

    While there is not any support for modifying the price series (such as Close, Open, Time, Volume, etc), you can read data from a file with a C# StreamReader and use this in your conditions.

    Below is a link to the SampleStreamReader reference sample in the help guide which provides sample code.


    The reference sample is an indicator, however a C# StreamReader could also be used in a custom addon window if this is what you are wanting.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      ok thanks. if the file contents change will I need to create another instance of StreamReader?

      Comment


        #4
        Hello fingers,

        The file would need to be re-read. The easiest way would be to create a new instance of the StreamReader.

        sr = new System.IO.StreamReader(path);

        From a google search I've found setting the Position and clearing the buffer may have the same result.
        I'm reading a file in line-by-line and I want to be able to restart the read by calling a method Rewind(). How can I manipulate my System.IO.StreamReader and/or its underlying System.IO.FileStream...
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        92 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        138 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        122 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        73 views
        0 likes
        Last Post PaulMohn  
        Working...
        X