## Reversing The Order Of Chart Data In The Spreadsheet

It is possible to reverse the order of chart data through cell references when using the Spreadsheet studies. For example, you can use an unused column, like column CA, and fill it with references to column E ( Closing Price ) or whatever column you need. If you have the Number of Rows input set to 500, then in cell CA3 you would enter =E502, cell CA4 would be =E501 and so on. Your formulas can then refer to this new CA column.

We plan to offer a feature in an upcoming version to reverse the order of the chart data outputted to a Spreadsheet.

## Locking the State of a One Time Condition

You may have a condition which occurs once and you want to continue to return a TRUE value in your System/Alert formula even if that condition no longer is present.

This can be accomplished by checking the return value from a formula within that same formula. Here is an example: =OR(E3=10,K3>0). This formula is located in cell K3. We check to see if a cell E3 equals 10 and if it does at least once, we will continue to return TRUE.

This formula uses a reference back to itself. This is properly supported with New Spreadsheets.

The method by which you can reset the locked state is by using this formula: =AND(OR(E3=10,K3>0),H3=FALSE) which references a cell (H3) which can be manually set to TRUE (1) or FALSE (0) . To perform a reset set H3 to TRUE, and then back to FALSE.

By using the method of locking the state of a one-time condition, we can use this to limit auto trading.

For an example, save the OneTradeExample.scss file. This file needs to be saved to the Sierra Chart Data Files Folder. To determine the location of this folder, select Global Settings >> General Settings. Refer to the Data Files Folder box for the folder. Once the file is saved, open this file by selecting File >> Open Spreadsheet.

This example Spreadsheet demonstrates limiting auto trading to one Buy Entry and one Sell Entry. The relevant formulas can be found in cells J28, H3 through H8 on Sheet1 and are described in detail below.

• H4: This cell contains a formula which checks for a long position. When there is a long position it becomes TRUE and stays true until reset. The result of this formula needs to be referenced in your Buy Entry formula to prevent a second entry until a reset. Example: =AND (H4= FALSE, [your conditions]).
• H6: This cell contains a formula which checks for a short position. When there is a short position it becomes TRUE and stays true until reset. The result of this formula needs to be referenced in your Sell Entry formula to prevent a second entry until a reset. Example: =AND (H6= FALSE, [your conditions]).
• H8: This cell is used to reset the cells H4 and H6. It needs to be manually set to 1 and then back to zero to do a reset.
• J28: This cell is used to disable auto-trading. When cells H4 and H6 are both true, then auto-trading is disabled. The use of the cell in this particular example is not necessary but it's a good idea.

## Accessing Tick by Tick Data

To access 1 Tick data in a Spreadsheet or what also is known as Time and Sales data, then this is accomplished by setting the chart and 1 trade per bar. To do this, select Chart >> Chart Settings. Set Intraday Bar Period >> Bar Period Type to Number of Trades Per Bar and the corresponding setting to 1.

Each row in the Spreadsheet will be a single trade. In order to be certain you have tick by tick data, refer to Tick by Tick Data Configuration.

You can also add the Bid Volume and Ask Volume studies to the chart to access that data as well. This will give you an indication of whether the trade occurred at the bid or the ask. The data for those studies will appear at column AA on the Spreadsheet, by default.

## Exporting Sheet Data Containing Price and Study Data to Text File

When using one of the Spreadsheet Studies, the Spreadsheet Sheet the chart data is outputted to will contain the main price graph and study data from the chart.

This data can be saved to a tab delimited text file and used in other programs. Follow the instructions below to do this.

1. Follow the instructions to use the Spreadsheet Study so that the chart data is outputted to a Sheet in the Spreadsheet window.
2. Using the list box at the top left of the Spreadsheet window, select the particular Sheet the chart data is outputted to. This will be the same as the Chart Number. For example, Chart #3 will be outputted to Sheet3.
3. Select File >> Save As on the menu.
4. In the File Type list box at the bottom of the File Save window, select Text Files.
5. In the File Name box, type a name that you want to save the text file as.
6. Press the Save button to save the file.
7. The File will be located in the Sierra Chart Data Files Folder which is specified in Global Settings >> General Settings.
8. You can then do with the text file what you require in any other program. All of the main price graph data and study data will be located in that file. The columns of data in the text file from the Sheet are separated by tab characters.

## Displaying Result of Spreadsheet Formula as Text on Chart

The following files demonstrate using a Spreadsheet to display the result of a formula on the chart as text. In this case, the formula is in cell K3.