Using StreamReader to read from a text file

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Educational Resources > Reference Samples > Indicator >

Using StreamReader to read from a text file

Previous page Return to chapter overview Next 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 Tools > Import > NinjaScript
3.Select the downloaded file

 

SampleStreamReader_NT8.zip