Login Page - Create Account

Technical Studies Reference

Write Bar and Study Data To File

This study will write the Date, Time, Open, High, Low, Last, Volume, Number of Trades, OHLC Average, HLC Average, HL Average, Bid Volume, Ask Volume bar data that is loaded into the chart and the study Subgraph values for each chart bar for the studies on the chart, to the specified text file and update that file in real-time.

Each line in the file will represent one bar in the chart. Therefore, if the chart bars are a 1 Minute timeframe, then each line in the data file will be 1 Minute and the study values for each of those bars will be written as well.

Only the data that is loaded into the chart will be outputted to the text file. To control the number of days outputted to the text file, adjust Chart >> Chart Settings >> Use Number of Days to Load >> Days to Load.

The file is continuously updated as new bars are added to the chart.

The very last bar is not written to the data file since it is not considered complete. Only when there is a new bar added to the chart, will then the prior last bar will be written to the file. If you require any changes to this behavior, it is necessary to Modify the study to meet your requirements.

If you will be modifying the study, refer to the sc.WriteBarAndStudyDataToFileEx ACSIL function which you can use to have full control over what data is exported. However, other coding is likely to be required as well.

The time stamping of the data in the file will be the same as the times displayed in the chart. So it is according to the charts Time Zone.

The output filename is by default [symbol]-BarData.txt. The file is written to the Sierra Chart Data Files Folder. To determine the location of the Data Files Folder, select Global Settings >> General Settings. Refer to the Data Files Folder box.

There is also the menu command Edit >> Export Bar and Study Data to Text File to perform a manual export all of the chart data at any time, which can be used instead of this study.


  • Include Hidden Studies: When this Input is set to Yes, then the studies that are set to be hidden on the chart are also written to the text file. When this is set to No, this will not be the case.
  • Path and File Name: This Input is used to specify the folder and the filename for the file to write the data to. This is optional. If it is not set, the Data Files Folder which is set through Global Settings >> General Settings will be used as the folder. The filename will contain the symbol, the text "-BarData", and the file extension will be txt. If only a file name is specified, the default folder will be used which is the Data Files Folder.

Special Considerations When Outputting Numbers Bars Calculated Values

When using the Write Bar and Study Data to File to output data from the Numbers Bars Calculated Values study, the data may not be output to the desired number of decimal places by default. This is due to the Numbers Bars Calculated Values having a default Value Format of 1, but with some of the rows overriding this Value Format when being written to the screen, but not when being output using this study.

In order to correct for this, change the Value Format to the number of decimal places for the desired output. For information on changing the Value Format for a study, refer to Value Format.

When this change to the Value Format is done, all of the data that is output from the Numbers Bars Calculated Values will be to the defined number of significant digits regardless of how the information is displayed on the screen or the nature of the underlying data. For example, if the Value Format is changed to 0.01 and Total Volume is output, the Total Volume in the file will look like 1234.00, even though it is integer data.

*Last modified Wednesday, 29th April, 2020.