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

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 samish18, Today, 11:26 AM
        0 responses
        1 view
        0 likes
        Last Post samish18  
        Started by Trader146, 03-29-2024, 01:22 PM
        2 responses
        14 views
        0 likes
        Last Post Trader146  
        Started by tsantospinto, 04-12-2024, 07:04 PM
        7 responses
        126 views
        0 likes
        Last Post aligator  
        Started by futtrader, 04-21-2024, 01:50 AM
        5 responses
        56 views
        0 likes
        Last Post NinjaTrader_Eduardo  
        Started by PeakTry, Today, 10:49 AM
        0 responses
        2 views
        0 likes
        Last Post PeakTry
        by PeakTry
         
        Working...
        X