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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        41 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        28 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        45 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        37 views
        0 likes
        Last Post CarlTrading  
        Working...
        X