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 pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        11 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        16 views
        0 likes
        Last Post AaronKoRn  
        Working...
        X