NinjaScript > Educational Resources > Reference Samples > Indicator >

Using StreamReader to read from a text file

Print this Topic Previous pageReturn to chapter overviewNext page

Sometimes you may have data stored outside of NinjaTrader that you want to bring in and use for calculations. Using StreamReader will allow us to bring in the data stored in text files and allow us to do manipulations with them.

 

Key concepts in this example

Opening a text file with StreamReader
Parsing Open-High-Low-Close data with date stamps from a file
Determining current day Open-High-Low-Close after reading data from the text file with StreamReader

 

Important related documentation

StreamReader
ReadLine
StringReader
TextReader

 

Import instructions

1.Download the file contained in this Help Guide topic to your PC desktop
2.From the Control Center window, select the menu File > Utilities > Import NinjaScript
3.Select the downloaded file and click Import.

 

SampleStreamReader_NT7.zip