NinjaScript > Educational Resources > Reference Samples > Indicator >

Using StreamWriter to write to a text file

Print this Topic Previous pageReturn to chapter overviewNext 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 File > Utilities > Import NinjaScript
3.Select the downloaded file and click Import.

 

SampleStreamWriter_NT7.zip