Using StreamWriter to write to a text file

<< Click to Display Table of Contents >>

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

Using StreamWriter to write to a text file

Previous page Return to chapter overview Next page

Sometimes you may want to store information related to certain market conditions or trades outside of NinjaTrader. The formatting of the text file can also make for easy importing into Microsoft Excel in the future.

 

Key concepts in this example

Creating a text file with StreamWriter
Writing Open-High-Low-Close data with date stamps to the file

 

Important related documentation

StreamWriter
WriteLine
StringWriter
TextWriter

 

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

 

SampleStreamWriter_NT8.zip