Spreadsheet Systems, Alerts and Automated Trading


On This Page


In recent versions of Sierra Chart we have renamed Workbook and Worksheet to Spreadsheet. The 3 Worksheet studies now have been renamed and begin with the name Spreadsheet. Worksheet Study has been renamed to Spreadsheet Study. This documentation uses the term Spreadsheet. In the version of Sierra Chart you are running, you may refer to the study names beginning with the old name Worksheet.

General Information

The Spreadsheet System/Alert study and the Spreadsheet System for Trading study can be used to create a Trading System or an Alert for your chart. A trading system or an alert means rules that you define which will provide buy or sell signals when the rules are true for a particular bar in the chart. These signals will be shown as graphical indications on the chart, show text alert lines and give audible alerts. In the case of the Spreadsheet System for Trading study, actual trade orders will also be given. An alert refers to the signal given when your System/Alert rules are true on the last bar. All of this is described in more detail below.

If you are just interested in getting an alert when your condition is true at the end of the chart and you do not need to see historical graphical indications on the chart of this, then in most cases you can just simply use the Simple Alert feature. And not bother using the more advanced Spreadsheet studies.

The difference between the Spreadsheet System for Trading study as compared to the Spreadsheet System/Alert study, is that the Spreadsheet System for Trading study has much more advanced logic for creating a trading system. With with the Spreadsheet System for Trading study you can perform back testing and generate actual trade signals either which will be simulated or can be sent to your trading service. By default they will always be simulated. Even if you do not actually want to place Live orders with the Spreadsheet System for Trading study, and you just want to create a system and back test it, or just wish to place trades manually from it, you still will want to use the Spreadsheet System for Trading study rather than the Spreadsheet System/Alert study. If you just simply want to create a simple System or advanced Alert to give you an indication when your rules return TRUE, then you will want to use the Spreadsheet System/Alert study.

Creating a System/Alert is accomplished by entering a Condition Formula in the formula columns on the Spreadsheet. This Condition Formula can access the price and study data (Study data is outputted beginning at column AA). This Condition Formula will be applied across the entire price graph. It will be continuously monitored and also can be scanned for (you should not do automated trading from a scan). This Condition Formula is used to give an indication of when a certain condition is TRUE for any chart column/bar. These indications are used to create a trading system or an alert. There is no difference between the way the program does systems and alerts. Both give graphical, text, and audible indications when your Condition Formula is TRUE. Although, a text message, audible sound, and a trade signal, in the case of the Spreadsheet System for Trading study, are only given when a Condition Formula returns TRUE on the very last column in the chart. Also, when a Condition Formula is TRUE on the very last column in the chart, then an ! mark will be displayed in front of the study name and the study name will be highlighted in red. The alert message text and the audible alert sound are what constitute an alert indication.

In the case of the Spreadsheet System for Trading study, a trade signal and an alert are not necessarily given when your Condition Formula in one of the Buy/Sell Entry/Exit formula columns returns TRUE on the last column in the chart. There is other logic that is applied and other conditions have to be met. All of this is explained on this page. Additionally, in the case of the Spreadsheet System for Trading study, if your Condition Formula returns TRUE on the last column in the chart, it will be ignored if data is being downloaded into the chart or when the chart is fully recalculated. These are safeties to prevent trades from being given unintentionally, in case you are not in trade simulation mode.

Sierra Chart provides a text alert for your Condition Formula when it becomes TRUE by adding a detailed message to the Alerts Log. To open the Alerts Log, select Window >> Show/Hide Alerts Manager >> Alerts Log on the menu. If the condition is TRUE at a chart column/bar other than the last chart column, then only a graphical indication is given.

Creating a System or Alert

This section applies to the Spreadsheet System/Alert study.

  1. Follow the step-by-step Spreadsheet Study instructions.

  2. When following those instructions and you get to the step to add the study to the chart, make sure you add the Spreadsheet System/Alert study instead.

  3. When you get to the step where you enter a formula, enter your System/Alert Condition Formula instead. Refer to the Examples section below for example Spreadsheet System/Alert Condition Formulas.

In the case of the Spreadsheet System/Alert study, the formula results from the Spreadsheet will be displayed in the main price graph area (Chart Region 1) of the chart and drawn with Up/Down Arrow styles by default. The Draw Style can be changed through the Subgraphs settings on the Subgraphs tab of the Study Settings window for the Spreadsheet System/Alert study. For instructions, refer to Adding/Modifying studies.

The formulas on the Spreadsheet should return either a 1 (TRUE) or 0 (FALSE) value. A value of 1 or TRUE indicates the System/Alert formula condition has been met. For example: Enter =ID0.SG4@3 < 100 in row 3 of the K formula column to set up a Long Entry alert when the closing price is less than 100.

Long Entry Column

The K column is the Long Entry column. If a cell in this column is TRUE (1), then an Up Arrow (depends upon the Subgraph Draw Style) will be drawn on the chart at the low value of the corresponding bar to indicate a Long Entry for that bar.

Long Exit Column

The L column is the Long Exit column. If a cell in this column is TRUE (1), then a Left Arrow (depends upon the Subgraph Draw Style) will be drawn on the chart at the high value of the corresponding bar to indicate a Long Exit for that bar.

Short Entry Column

The M column is the Short Entry column . If a cell in this column is TRUE (1), then a Down Arrow (depends upon the Subgraph Draw Style) will be drawn on the chart at the high value of the corresponding bar to indicate a Short Entry.

Short Exit Column

The N column is the Short Exit column. If a cell in this column is TRUE (1), then an Right Arrow (depends upon the Subgraph Draw Style) will be drawn on the chart at the low value of the bar to indicate a Short Exit.

Other Columns

When graphing columns other than K, L, M, or N with a visible Draw Style, the return value of the Condition Formula must be within the range of values of the main price graph your study is overlaid on. Otherwise, the subgraph display will adversely affect the display of the chart.

There is no automatic translation from TRUE (1) or FALSE (0) to high and low bar values, from the formula columns O and higher.

An example formula that you can use for formula columns O and higher is =IF(ID0.SG4@3 > 100, C3, 0).

Changing Column Names

The above are the default System/Alert formula column names. You can rename the columns at row 2 in the Sheet and use them for any kind of condition. To rename a column, click two times on the cell with the name in row 2 and type a new name.

Controlling the Location of Arrows or Subgraph Values

You can also return values other than TRUE (1) or FALSE (0) in your System/Alert Condition Formulas.

If the value returned by the formula is not TRUE (1) or FALSE (0), then the arrow will be drawn at the value the formula returns when using columns K, L, M, or N when using the Spreadsheet System/Alert study.

For formula columns O and higher, the Subgraph arrows or whatever the Draw Style is, will always be drawn at the value returned from the formula.

Scanning

When you are using the Spreadsheet System/Alert study, you are able to scan for TRUE results from your System or Alert condition formulas among a list of symbols. For more information, refer to the Scan Menu commands documentation.

Creating a Trading System for Automated Trading

Halting Order Entry

If you are using the Spreadsheet System for Trading study on a Live account and sending orders to the connected Trading service, and you wish to halt order entry for any reason, you can do any of the following:

  1. Enable Trade Simulation Mode by making sure that there is a check mark by Trade >> Trade Simulation Mode On.
  2. Set the Send Orders To Trade Service input with the Spreadsheet System for Trading study to NO.
  3. Set the Disable Auto Trading cell on the Sheet# in the Spreadsheet used by the Spreadsheet System for Trading study, to TRUE.
  4. Disable the Trade >> Auto Trading Enabled command.

Steps To Create a Trading System for Automated Trading

  1. First make certain that auto trading is enabled. Make certain there is a checkmark by Trade >> Auto Trading Enabled on the menu.
  2. Make sure there is a check mark by Trade >> Trade Simulation Mode On on the menu. This is so that orders will not be sent to your trading service. Instead all trades will be simulated.

    Additionally, the Send Orders To Trade Service input with the Spreadsheet System for Trading study must be set to No . This also prevents the orders from being sent to the connected Trading service. With these two settings, there are two layers of protection against sending actual orders.

    For complete details, refer to SendOrdersToTradeService.
  3. Go to an open chart or open a chart with File >> Find Symbol.
  4. Enable Trade >> Chart Trade Mode . Select Trade >> Attach Trade Window to Chart. When chart trading mode is activated on a chart, you will see the Orders and the Position from your automated trading system displayed on the chart. By attaching the Trade Window to the chart, you will have a complete trading control panel available to take any manual actions that you require and to set Attached Orders. More details can be found in the Chart Trading documentation.
  5. Select Analysis >> Studies on the menu.
  6. Select Spreadsheet System for Trading in the Studies Available list on the left. Do not confuse this study with the Spreadsheet Study or the Spreadsheet System/Alert studies.
  7. Press the Add button to add the Spreadsheet System for Trading study to the Studies to Graph list.
  8. For this example, also add the study named Moving Average-Simple. You do not need to change the settings for this study, the defaults are acceptable. We will create a system that will Buy when the current price moves above a moving average and Sell when the current price moves below a moving average. This is only intended as an example in these instructions. This is not necessarily a practical trading system for actual use.

    If you want to make a system different than this example by using other studies, add them to the chart now if you have not already added them. Adjust the settings as you require them for each study.
  9. Highlight the Spreadsheet System for Trading study in the Studies to Graph list box. Press the Settings button. In the Technical Study Settings window on the Settings And Inputs tab, there is a text box for the Spreadsheet Name (lower left). Enter a name in the text box without a file extension. This is the name of the Spreadsheet that will be opened or created to contain the data and formulas. The name should be related to what your custom system will do.
  10. To have the orders sent to the Sierra Chart internal Trade Simulation system, the Send Orders To Trade Service input needs to be set to No. To send order signals to the connected Trading service, the Send Orders To Trade Service input needs to be set to Yes and you also need to disable Trade >> Trade Simulation Mode On on the menu. For complete details, refer to SendOrdersToTradeService.
  11. In the Input list, you will find in input named Maximum Position Allowed in Same Direction. Set this input as you require. It is the maximum Position in shares or contracts that is allowed.
  12. The other inputs are correct as they are for this example. For more information about all of the inputs, refer to Inputs That Are Specific to Systems, Alerts, and Automated Trading.
  13. In the list of available study Inputs you will see inputs named Column K-Z Alert. Set these to the Alert Sound Number you want to hear when your System/Alert Condition Formula in the corresponding column becomes TRUE at the last bar. For more information, refer to Sound for Audible Alert and E-Mail Message Notifications.
  14. Press the OK button on the Technical Study Settings window.
  15. Press the OK button on the Chart Studies window.
  16. The Spreadsheet will be opened in the background. Go to it by selecting CW on the menu. The name of the spreadsheet will be listed and can be selected. The name will be what you have specified in the Study Settings window for the study.
  17. A Spreadsheet contains multiple Sheets. The Sheet number the data is outputted to, is the same Sheet number as the chart number. For example, chart #2 will be outputted to Sheet2 in the Spreadsheet.

    The Sheet can be selected with the list box at the top left of the Spreadsheet. All of the individual chart studies are also outputted to the same Sheet beginning at column AA (the default when using 16 formula columns).
  18. Select the Sheet# from the list box at the top left of the Spreadsheet window that corresponds to the Chart Number that contains the Spreadsheet System for Trading study.
  19. Set the cell J26 ( Order Quantity) to the number of shares or contracts you want to trade when an order is sent. This can also be set to 0 and the Order Quantity will be determined from the chart Trade Window.
  20. All new orders use the settings of the Trade Window for the chart. Go to the chart that contains the Spreadsheet System for Trading study. Select Trade >> Open Trade Window for Chart to see what the settings are set to. For example, if the Time in Force is set to Day, all new orders submitted from the Spreadsheet will automatically have a Time in Force of Day.

    The settings that you can set in the Trade Window also include Attached Orders. For complete instructions for Attached Orders, refer to the Attached Orders page.
  21. The following steps provide an example of a trading system using Spreadsheet formulas. Buy Entry and Sell Entry formulas are given.
  22. To Buy when the Last price crosses from below the moving average, type in cell K3 (labeled: Buy Entry):

    =CROSSFROMBELOW( ID0.SG4@3:ID0.SG4@4, ID2.SG1@3:ID2.SG1@4)

    Where ID0.SG4@3:ID0.SG4@4 refers to the current and previous last trade prices of the chart bars and ID2.SG1@3:ID2.SG1@4 refers to the current and previous Moving Average - Simple study values which are located in column AA . In all places in the example formulas on this page, ID2 may need to be changed to the actual ID# number used by the Moving Average study. You can see the actual ID# number in row 1 in the column that the study is outputted to. Refer to the image below:


    You can also optionally use: =AND( CROSSFROMBELOW( ID0.SG4@3:ID0.SG4@4, ID2.SG1@3:ID2.SG1@4), $J$8=0)

    $J$8 is the current Trade Position quantity. This can be used to check the Position is flat before entering the market. The underlying automated trading logic checks this, but it can be checked in your formula to avoid unnecessary messages to the Trade >> Trade Service Log. The disadvantage is that you cannot see on the chart your historical buy and sell signal arrows without running a back test.
  23. For an understanding of references like ID2.SG4@3, refer to References to Study Subgraph Columns when using the Spreadsheet Study.
  24. To Sell when the Last price crosses from above the moving average, type in cell M3 (labeled: Sell Entry):

    =CROSSFROMABOVE( ID0.SG4@3:ID0.SG4@4, ID2.SG1@3:ID2.SG1@4)

    Where ID0.SG4@3:ID0.SG4@4 refers to the current and previous last trade prices of the chart bars and ID2.SG1@3:ID2.SG1@4 refers to the current and previous Moving Average - Simple values which are located in column AA.

    You can also optionally use: =AND( CROSSFROMBELOW( ID0.SG4@3:ID0.SG4@4, ID2.SG1@3:ID2.SG1@4), $J$8=0)

    $J$8 is the current Trade Position quantity. This can be used to check the Position is flat before entering the market. The underlying automated trading logic checks this, but it can be checked in your formula to avoid unnecessary messages to the Trade >> Trade Service Log. The disadvantage is that you cannot see on the chart your historical buy and sell signal arrows without running a back test.
  25. Using these formulas, when the Last price crosses from below the moving average, K3 (Buy Entry) will trigger a Buy order, and when the Last price crosses from above the moving average, M3 (Sell Entry) will trigger a Sell order.

    By default, only one order can be sent until a corresponding Exit signal is given. Therefore, if there has already been a Buy Entry, then all other Buy Entry signals are ignored until the Buy Exit formula becomes TRUE and triggers a Sell or the Position is flattened by another method.

    If there has already been a Sell Entry, then all other Sell Entry signals are ignored until the Sell Exit formula becomes TRUE and triggers a Buy or the Short Position is flattened by another method.

    This behavior is controlled with the Allow Multiple Entries In Same Direction Input. If the Allow Opposite Entry with Opposing Position or Orders Input is set to Yes, which is the default, then if there currently is a Long Position, then a Sell Entry can exit that Position. The same with a Short Position and Buy Entry.

    If you have multiple conditions for your trading system, then you will need to use the AND() function. For example, if you have a RSI (Relative Strength Index) study on the chart and the data is outputted to column AC on the Sheet, and you want to combine that with the Moving Average study, use a formula similar to this for the Buy Entry: =AND( CROSSFROMBELOW( ID0.SG4@3:ID0.SG4@4, ID2.SG1@3:ID2.SG1@4), ID3.SG1@3 < 40). ID3.SG1@3 references the RSI study assuming it has a study ID of 3.

    For further information, refer to References to Study Subgraph Columns when using the Spreadsheet Study.
  26. In this example we will create a Buy Exit (Sell) that exits a Position when a Stop or Target value is reached. A Buy Exit is optional. A Sell Entry could close out a Position created by a Buy Entry. Or, the Position can be closed out manually or with an Attached Order. In this example, we are using a Buy Exit formula to show you an exit strategy managed completely by the Spreadsheet System for Trading study.

    In cell L3 (labeled: Buy Exit), type =OR( AND( $J$8 > 0, ID0.SG4@$3 <= $J$9-1), AND( $J$8 > 0, ID0.SG4@$3 >= $J$9+2)). ID0.SG4@$3 refers to the Last price of the most recent chart bar, $J$8 refers to the current Position Quantity, and $J$9 refers to the current Position Average Price.

    When this formula in cell L3 returns TRUE, it will trigger a Sell order. What this formula means is that when there is a Long Position AND the last price is less than the price the Buy Entry was filled at minus 1 full point (Stop), OR there is a Long Position AND the last price is greater than the price the Buy Entry was filled at plus 2 full points (Limit), then return TRUE. This will cause a Sell order to be placed. This is just an example and you need to use what is appropriate in your specific case.

    Note: It is essential that the formula contains a check that there is a Position > 0. This is explained in more detail in the Buy Exit section.

    The $ means a cell reference refers to an absolute cell and the column and row will not be adjusted when the formula is automatically filled down. This formula is relevant only to the topmost row in the Spreadsheet (corresponds to the last bar in the chart), even though it is applied to historical bars as well. Refer to the Special Spreadsheet Outputted Values section for more information on the data in the J column.

    When entering numbers and formulas, keep in mind to use the proper delimiters in the numbers and formulas, according to the Global Settings >> Spreadsheet Settings >> Decimal and Function Delimiters setting. For more information, refer to the Decimal and Function Delimiters section.
  27. In this example we will create a Sell Exit (Buy) that exits a Position when a Stop or Target is reached. A Sell Exit is optional. A Buy Entry could close out a Position created by a Sell Entry. Or, the Position can be closed out manually or with an Attached Order. In this example, we are using a Sell Exit to show you an exit strategy managed completely by the Spreadsheet System for Trading study.

    In cell N3 (labeled: Sell Exit), type =OR( AND( $J$8 < 0, ID0.SG4@$3 >= $J$9+1), AND( $J$8 < 0, ID0.SG4@$3 <= $J$9-2)). ID0.SG4@$3 refers to the Last price of the most recent chart bar, $J$8 refers to the Position Quantity, and $J$9 refers to the Position Average Price.

    When this formula in cell N3 returns TRUE, it will send a Buy order. What this formula means is that when there is a short Position AND the last price is greater than the price the Sell Entry was filled at plus 1 full point (Stop), OR there is a short Position AND the last price is less than the price the Sell Entry was filled at minus 2 full points (Limit), then return TRUE. This will cause a Buy order to be placed. This is just an example and you need to use what is appropriate in your specific case.

    Note: It is essential that the formula contains a check that there is a Position < 0. This is explained in more detail in the Sell Exit section.

    The $ means a cell reference refers to an absolute cell and the column and row will not be adjusted when the formula is filled down. This formula is relevant only to the topmost row in the Spreadsheet (corresponds to the last bar in the chart), even though it is applied to historical bars as well. Refer to the Special Spreadsheet Outputted Values section for more information on the data in the J column.
  28. NOTE:In the case of actual live trading, these Stops and Targets are sent by Sierra Chart to the connected trading service when the conditions are met. This is necessary in order to accomplish advanced exit strategies. Although these are not advanced exit strategies, we demonstrate how you can do advanced exit strategies.
  29. In order for an order to be placed as fast as possible, it is a good idea to make sure the Chart Update Interval, which is set through Global Settings >> General Settings on the menu, is set to 1000 milliseconds or less. However, avoid making it very small unless your computer is very fast.
  30. You can also use Attached Orders for exiting a Position. Refer to Initiating Trades with Auto-Trading and Using Manual or Attached Orders Exits.
  31. Now that we have entered the Spreadsheet formulas on the Spreadsheet, it is necessary to go back to the chart. Select Window on the menu and select the chart that you applied the Spreadsheet System for Trading study to, or select it from the chart window tabs which are located at either the top or bottom of the main window. To ensure the formulas that have been entered are fully copied down the formula columns on the Spreadsheet, select Chart >> Recalculate on the menu.
  32. Refer to the buy and sell arrows on the chart. These arrows represent the TRUE values returned from the Buy Entry and Sell Entry Condition Formulas in the formula columns. By default the Subgraph Draw Style for the Exit columns (L and N) are set to Hidden, so they do not appear.
  33. In this example, we use exits which are based upon Position data which is only known for the current Position, so the Buy/Sell arrows are not relevant historically. If your exits were based upon the price and/or study data, then you could set the corresponding Exit columns to a visible Draw Style.
  34. Make certain there is a check mark by Trade >> Auto Trading Enabled so the TRUE results that your Condition Formulas provide, will be processed as trades.
  35. As the chart is updated, either with real-time streaming data received from the connected data feed, or during a replay, the Buy and Sell Entry and Exit signals will cause Trade orders to be generated and processed. These signals also produce alert messages and these can be viewed by selecting Window >> Show/Hide Alerts Manager >> Alerts Log on the menu.
  36. To view your Trade orders, select Trade >> Trade Activity Log on the menu.
  37. To view the Trade Service Log, select Trade >> Trade Service Log on the menu. The Trade Service Log displays ignored signals from your Condition Formulas.
  38. The next step is to simply watch your system perform in real-time as your chart is updated or replay your chart to perform Back Testing. Back testing through replays is a very good way to test your system on historical data and get a good feel for it.
  39. To go from simulated trading to non-simulated (Live) trading, follow the instructions in Going From Simulated Trading to Non-Simulated (Live) Trading.

Going From Simulated Trading to Non-Simulated (Live) Trading

If and when you are ready to have your trading system submit real orders, you will need to go to non-simulated mode by making sure there is no check mark by Trade >> Trade Simulation Mode On.

Next, go to the Study Settings for the Spreadsheet System for Trading study on your chart and set the Send Orders To Trade Service input to Yes.

For complete details, refer to SendOrdersToTradeService.

At this time any trading signals given will be sent as orders to your Trading service, assuming you are connected to a valid Trading service and you are connected to the Data and Trade server (File >> Connect to Data Feed).

Keep in mind that if you are using a simulated account with your Trading service, then even though you are not in Sierra Chart Trade Simulation Mode and Send Orders To Trade Service is set to Yes, the orders will still be simulated.

Sound for Audible Alert and E-Mail Message Notifications

You can specify an alert sound to be played when the System or Alert condition in cells K3 through Z3 become TRUE. For the formulas in the Sheet to trigger sound alerts requires enabling them.

Go to the Study Settings window for your Spreadsheet Study. For instructions, refer to Modifying Studies. Keep in mind, that after a Spreadsheet Study is applied to a chart it changes its name in the Studies to Graph list on the Chart Studies window to the name of the Spreadsheet file it references.

On the Settings and Inputs tab of the Study Settings window you will see a list of all of the available study Inputs. You will see several inputs named Column K,L,M,N,O,P,Q,R,S,T,U,V-Z Alert that will let you select the Alert Sound Number to be used for each column.

Select the Alert Sound Number that you want to use, or select No Alert to not play an alert sound when a formula becomes TRUE in cells K3 through Z3. Sheet columns W through Z use the same alert sound number as column V.

To set the sound file that plays for each alert number, select Global Settings >> General Settings on the menu. You can also setup an email message to be sent when an alert sound is triggered.

If the Draw Style for a Sheet column is set to Ignore, then no System or Alert signals can be triggered by the Sheet formulas. However, this does not apply to column K through N when using the Spreadsheet System for Trading study. With that study, Trade signals can always be triggered by the Sheet formulas regardless of the Draw Style setting.

Initiating Trades with Auto-Trading and Using Manual or Attached Orders Exits

It is not necessary to use the Buy Exit or Sell Exit Order Action formula cells in the Spreadsheet System for Trading study to exit a Position. Exits can be done by manually entering an order through the Trade Window (Trade >> Open Trade Window for Chart) or can be performed by using the Attached Orders feature (Targets and Stops). When using Attached Orders, you will then leave the Buy Exit or Sell Exit Order Action formula cells blank.

Targets and Stops are configured through the Trade Window on the Attached Orders tab. For more information, refer to the Attached Orders documentation page.

The set of Attached Orders which is entered on the Trade Window for a chart, Trade >> Open Trade Window for Chart, is saved when a Chartbook is saved.

Orders that are given by the Buy Exit or Sell Exit Order Action formula cells will not use the Attached Orders configured in the Trade Window. Only Buy Entry and Sell Entry will use them.

When you are using the automated trading functionality in Sierra Chart , it is recommended that you always enter and cancel any manual orders from within Sierra Chart to avoid any unexpected auto trade issues due to Sierra Chart not being aware of the orders and Position changes you do from other trading programs.

For additional information about using Attached Orders with an automated trading system, refer to SupportAttachedOrdersForTrading.

Using Both Attached Orders and Buy Exit and Sell Exit at the Same Time

It is possible to define a set of Attached Orders to use with your Spreadsheet System for Trading study and also use the Buy/Sell Exit columns at the same time. For this to work properly, you need to set Cancel All Working Orders On Exit input to Yes.

Trade Window Order Quantity with Attached Orders

When you are using Attached Orders with a Spreadsheet System for Trading study, then the Order Quantity on the Trade Window will change to the current Order Quantity specified on the Spreadsheet. This is because the Attached Orders are defined through the Trade Window Targets tab, and it is necessary to update the quantity of the Trade Window to match the order quantity from the trading system in order for the Attached Orders to have a matching quantity.

For more information about setting the Order Quantity for the Spreadsheet System for Trading study, refer to Cell J26 (Order Quantity).

Automated Advanced Exit Strategies

You may want to enter a Position manually and then have an automated Position exit based upon certain technical conditions which can be based upon the price and study data. This is accomplished by using the Spreadsheet System for Trading study. Refer to the Creating a Trading System for Automated Trading instructions on this page to use this study and define your exit conditions. The study will need to be applied to a chart of the same symbol that you are trading.

When you use the Spreadsheet System for Trading study for this purpose, you will not use the Buy Entry and Sell Entry Order Action columns. These columns need to be left blank. Any steps in the instructions associated with them can be skipped. You will only use the Buy Exit and Sell Exit Order Action columns.

Spreadsheet System for Trading study Inputs related to Buy Entry and Sell Entry will not apply for your automated exit strategy.

When either the Buy Exit or Sell Exit Order Action columns become TRUE, an order will be submitted at that time. This can be any of the order types supported by the Spreadsheet System for Trading study. Only when your Exit condition is met, will the order be submitted, not before. Therefore, it is not possible to submit a Stop or Limit order ahead of time and modify it. Therefore, Sierra Chart needs to be running to monitor your current Position and submit the orders. It is possible to use the ACSIL Trading functions and modify an order that has been submitted.

Spreadsheet Study Inputs that are Specific to Systems, Alerts, and Automated Trading

This section lists Inputs for the Spreadsheet Studies which are specific to the Spreadsheet System for Trading and the Spreadsheet System/Alert studies. These inputs can only be set through the Study Settings window for the Spreadsheet studies.

For the other available Spreadsheet Study Inputs which are set through the Study Settings window, refer to the Spreadsheet Study Inputs page.

A Read-only display of these Study Inputs is displayed on the Spreadsheet Sheet that the chart data is outputted to, in cell columns I and J. It is not possible to modify the value of these Inputs through the Sheet cells. They can only be set through the Study Settings window for the Spreadsheet study.

Reset Condition On New Bar

If this option is set to Yes, then a system or alert signal will be given when a new bar is added to the chart and the System/Alert condition is TRUE at row 3 even though the System/Alert condition was previously TRUE on the prior bar/row. Normally, when a formula returns TRUE or a nonzero value in one of the Spreadsheet columns used for systems or alerts and a new bar is added, a new signal will not be given even if it still TRUE. It will have to go back to FALSE and then back to TRUE again, unless this input is set to Yes.

Alert/Signal Only Once per Bar

If the Alert/Signal Only Once Per Bar option is set to Yes, then an alert or trading signal will be given only once per Formula Column per bar in the chart.

When an alert or trading is given once for a specific Spreadsheet Formula Column, then another will not be given until there is a new bar in the chart and the System/Alert Condition Formula goes back to FALSE and then to TRUE.

This applies to each formula column independently. For example, in the case of the Spreadsheet System for Trading study, if there is a Buy Entry at a particular bar, there can still be a Buy Exit given at the same bar. However, there cannot be 2 Buy Entries on the same bar when this option is enabled.

It is recommended that if you have any trouble obtaining a trading signal when you normally would expect one, that you try setting this option to No.

In the case of the Spreadsheet System for Trading study, when a signal is ignored because of this option, that ignored signal will be logged in the Trade >> Trade Service Log. This is very helpful for troubleshooting purposes. The message is: Signal ignored because 'Signal Only Once Per Bar' is enabled and a signal was already given from formula column for bar.

Allow Multiple Entries In Same Direction

This input applies only to the Spreadsheet System for Trading study.

Refer to the description on the Auto Trade Management page.

Maximum Position Allowed

This input applies only to the Spreadsheet System for Trading study.

Refer to the description on the Auto Trade Management page.

Allow Opposite Entry with Opposing Position or Orders

This input applies only to the Spreadsheet System for Trading study.

Refer to the description on the Auto Trade Management page.

Send Orders To Trade Service

Refer to the description on the Auto Trade Management page.

This input applies only to the specific instance of the Spreadsheet System for Trading that it is set on. It has no effect on manually entered orders on the chart.

It also only applies to the specific Spreadsheet being used by the Spreadsheet System for Trading study.

Support Reversals

Refer to the description on the Auto Trade Management page.

Cancel All Orders on Entry and Reversals

Refer to the description on the Auto Trade Management page.

Signal Only on Bar Close

The Signal Only on Bar Close Inputs are specific to the Spreadsheet System for Trading study and the Spreadsheet System/Alert study. There are two versions of this input, one for Sheet columns K and M and the other for columns L, N-Z.

When this input is set to Yes, Sheet formulas that return a non-zero (TRUE) value at row 3 in the corresponding formula columns are ignored until the last bar closes. The way this is accomplished is row 4 is monitored instead of row 3.

When this input is set to Yes, then anywhere in the documentation row 3 is mentioned, it is row 4 instead. In the same way that row 3 is continuously monitored for TRUE results from formulas in the corresponding formula columns, row 4 will be continuously monitored when this input is set to Yes.

You may want to set Strict Signal Only On Bar Close Evaluation to Yes, when you set one of these inputs to Yes.

There is one scenario that you should keep in mind about when using Signal Only on Bar Close. Consider you have a formula and one of the Sheet formula columns and it returns TRUE at row 3 (the last bar of the chart) in the column. You refer to the arrow on the chart. A new bar is added, the bar therefore is considered closed, the formula moves down to row 4, it is no longer TRUE and the arrow disappears.

In this case when you are using Signal Only on Bar Close, you will not get a signal.

Strict Signal Only On Bar Close Evaluation

The Strict Signal Only On Bar Close Evaluation input applies a stricter method of evaluation when you have either of the Signal Only on Bar Close inputs set to Yes. When this input is set to Yes, then only at the moment when a bar closes when one or more new bars are added to the chart, will an evaluation of your Spreadsheet formulas from the corresponding Spreadsheet columns (K, M, L, N-Z) be evaluated for TRUE conditions. When this input is set to Yes, row 4 will not be continuously monitored as usual, only exactly at the moment when a bar closes and the chart is updated.

Use Chase Orders

This input only applies to the Spreadsheet System for Trading study. When this input is set to Yes and you have enabled limit orders for a particular Buy/Sell column, then the limit order will be submitted as a Limit Chase Order. The chase amount is set through the J46 cell labelled Maximum Chase Amount for Limit Chase Orders.

Enhanced Auto Trade Signal Related Logging

This Input when set to Yes, will log additional messages indicating the reason why an order signal is ignored from formula columns K, L, M, N at rows 3 and 4 when using the Spreadsheet System for Trading study.

This is helpful to troubleshoot problems with ignored signals.

Set this Input to Yes only for a short period of time and only when necessary because it generates a large amount of messages and can create a very heavy and unnecessary CPU load when doing back testing to the point where a tick by tick back test becomes next to impossible to complete and extremely burdensome.

BuyEntry (K), BuyExit (L), SellEntry (M), SellExit (N) Spreadsheet Order Action Columns

The following Spreadsheet Order Action Columns only apply to the Spreadsheet System for Trading study.

Note: For all of the below Order Actions: When an order is submitted, an Alert Sound will also be played if you selected an Alert Sound for the corresponding Spreadsheet column in the Input Settings in the Study Settings window. An alert message will also be added to the Window >> Alerts Manager >> Alerts Log.

Buy Entry (column K)

When your Condition Formula in row 3 of column K on the Spreadsheet returns a nonzero value or TRUE, then a Buy order will be given if certain conditions are met. For complete details, refer to the Auto Trade Management page.

Buy Exit (column L)

When your Condition Formula in row 3 of column L on the Spreadsheet returns a nonzero value or TRUE, then a Sell order will be given if certain conditions are met. For complete details, refer to the Auto Trade Management page.

You need to code into your Exit formulas by using the AND() Spreadsheet function, a check that there is a Trade Position Quantity. An example would be: =OR(AND($J$8 > 0, ID0.SG4@$3 <= $J$9-1), AND($J$8 > 0, ID0.SG4@$3 >= $J$9+2)).

The reference to cell J8 refers to the current Trade Position Quantity. The dollar signs in $J$8 mean it is an absolute Spreadsheet reference.

In the case of a Buy Exit formula, you must to check to make certain there is a long Trade Position by making certain that J8 is > than 0. The purpose of this is so that the formula remains FALSE until such time that a Trade Position can be exited.

Otherwise, the formula could become TRUE on a bar and give a signal even before there is a Trade Position. In this case it will be ignored as it should be. However, if it remains TRUE and then later on that very same bar or a different bar, when there finally is a Trade Position, there will no longer be an Exit signal because the prior TRUE state was already ignored and the formula remains TRUE and not giving a new signal.

Sell Entry (column M)

When your Condition Formula in row 3 of column M on the Spreadsheet returns a nonzero value or TRUE, then a Sell order will be given if certain conditions are met. For complete details, refer to the Auto Trade Management page.

Sell Exit (column N)

When your Condition Formula in row 3 of column N on the Spreadsheet returns a nonzero value or TRUE, then a Buy order will be given if certain conditions are met. For complete details, refer to the Auto Trade Management page.

You need to code into your Exit formulas by using the AND() Spreadsheet function, a check that there is a Trade Position Quantity. An example would be: =OR(AND($J$8 < 0, ID0.SG4@$3 >= $J$9+1), AND($J$8 < 0, ID0.SG4@$3 <= $J$9-2)).

The reference to cell J8 refers to the current Trade Position Quantity. The dollar signs in $J$8 mean it is an absolute Spreadsheet reference.

In the case of a Sell Exit formula, you must to check to make certain there is a short Trade Position by making certain that J8 is < than 0. The purpose of this is so that the formula remains FALSE until such time that a Trade Position can be exited.

Otherwise, the formula could become TRUE on a bar and give a signal even before there is a Trade Position. In this case it will be ignored as it should be. However, if it remains TRUE and then later on that very same bar or a different bar, when there finally is a Trade Position, there will no longer be an Exit signal because the prior TRUE state was already ignored and the formula remains TRUE and not giving a new signal.

Ignored Signals With Spreadsheet Systems or Alerts

Introduction

There are many cases in which a Buy or Sell signal from the Entry and Exit formula columns (K, L, M, N) will be ignored. When a signal is ignored from a formula that returns a nonzero number or TRUE, then there will be no Alert Sound played, Alert Message logged, or a Trade Order sent. This section explains all of this.

Enabling Auto Trading

If Trade >> Auto Trading Enabled is unchecked, then Buy and Sell trade order signals from the Spreadsheet System for Trading study will be ignored. In this case you will see messages added to the Trade >> Trade Service Log indicating this.

The Send Orders to Trade Service study Input setting needs to be set consistently with the Trade >> Trade Simulation Mode On setting on the menu. If it is not, then Buy and Sell trade order signals from the Spreadsheet System for Trading study will be ignored. In this case you will see messages added to the Trade >> Trade Service Log indicating this. For complete details, refer to SendOrdersToTradeService.

Ignored Signals During Historical Data Downloading

With the Spreadsheet System for Trading study and the Spreadsheet System/Alert study, System and Alert signals from the Sheet formula columns are ignored on historical data and when historical data is being downloaded. They are monitored for when the chart is actually updating with new data.

A chart will be updating with new data during real-time chart updating with live data, during replays, or during a Back Test. If you want to see the Back Test results from historical Buy and Sell signals from the Buy/Sell formula columns in the case of when using the Spreadsheet System for Trading study, then refer to the Back Testing section.

Buy/Sell Arrows Do Not Mean Trade Signals

When using the Spreadsheet System for Trading study and a formula returns TRUE in the Buy Entry (K3), Buy Exit (L3), Sell Entry (M3), or Sell Exit (N3) cell, a trade signal is not necessarily going to be given. You will see an arrow on the chart indicating a buy or sell signal, assuming the corresponding Subgraph Draw Style is set to a visible style.

However, this does not necessarily mean that the formula TRUE result will be followed and a trade signal will be given. The BuyEntry (K), BuyExit (L), SellEntry (M), SellExit (N) Spreadsheet Order Action Columns rules must be met and the additional conditions imposed by the related study Input Settings must be met, for a trade signal to be actually given. If one is ignored, then a message will be added to the Trade >> Trade Service Log indicating the reason.

Review the Trade Service Log for the reason. To see on the chart the actual filled orders from trades made, refer to Displaying Filled Orders.

Reset Condition on New Bar

When using either the Spreadsheet System for Trading or Spreadsheet System/Alert studies, the TRUE signals given from cells K3 through Z3 may not always be followed and give an alert or trade signal, even though they still return TRUE or a non zero value and an arrow shows on the chart. If a cell is TRUE and there is a new bar added to the chart and the cell continues to be TRUE, because the state is already TRUE, you will not get a new signal unless the input Reset Condition on New Bar is set to Yes.

Signal Only Once per Bar

If a TRUE signal has been given by the formula in a particular cell and then it goes back to FALSE and back to TRUE on the same bar, you will not get a signal if the study Input Signal Only Once Per Bar is set to Yes.

Signal Only on Bar Close

If you have the Signal Only On Bar Close (Column K,M) input set to Yes, then a TRUE signal will be ignored on cells K3 and M3, and only the cells K4 and M4 will be monitored for signals. Likewise with the Signal Only On Bar Close (Column L,N-Z) input.

In the case of when either Signal Only Once per Bar and Signal Only on Bar Close study Inputs have been set to Yes, when a signal is ignored by these restrictions, there is no message added to the Trade Service Log or the Alerts Log, except in the case of the Spreadsheet System for Trading study when the signal has been ignored as the result of Signal Only Once Per Bar being set to Yes.

Troubleshooting

In order to troubleshoot a problem with ignored signals, we recommend setting both of the Signal Only On Bar Close Inputs to No.

Detailed logging can also be enabled which will add reasons for ignored signals in all cases, to the Trade >> Trade Service Log.

When using the Spreadsheet System for Trading study, set the Enhanced Auto Trade Signal Related Logging Input to Yes.

When using the Spreadsheet System/Alert study, set the Enhanced System Signal Related Logging Input to Yes.

Only set these Inputs to Yes when absolutely necessary because they will add a very large number of messages to the Trade Service Log and can cause Sierra Chart to be nonresponsive at times.

System/Alerts and Draw Style

In the case of the Spreadsheet System/Alert study, if the Draw Style for a Spreadsheet column is set to Ignore, then System or Alert signals in that column will be ignored.

Nonzero Trade Position Quantity

In the case of the Buy Exit or Sell Exit Order Action columns when using the Spreadsheet System for Trading study, if a Buy/Sell Exit formula is TRUE and remains TRUE before there is a nonzero Trade Position Quantity and then a nonzero Trade Position Quantity later exists, then the Exit will be ignored it until it goes back to FALSE and then to TRUE.

Therefore, you need to program the formula to remain FALSE until there is a Trade Position Quantity. This can be done by using the AND function and checking that cell J5 is nonzero.

Delayed TRUE Result from Formulas

Another thing to also consider is that you may see an arrow on the chart from one of the Order Action formula column cells indicating TRUE, but it is on the bar prior to the last bar in the chart and it appeared after a new bar was added to the chart. Therefore, unless the corresponding Signal Only On Bar Close Input is set to Yes, then that TRUE result going to be ignored as well.

You cannot make an assumption that when you see a 1/TRUE in a cell, that at the moment the cell is evaluated for an order/alert signal that the 1/TRUE was present at that time. It may have been 0 and could have went to 1 quickly after.

Spreadsheet System for Trading Test Procedure

To get an understanding of how the TRUE signals in K3, L3, M3, N3 are processed follow the test procedures on the Spreadsheet System for Trading Test Procedure page.

After you go through this test procedure, and you are still having difficulty troubleshooting your Spreadsheet System for Trading study implementation, we recommend changing the formulas to simple TRUE/1 values temporarily during a replay just like explained in the test procedure, and then gradually add to the complexity of them until you can determine the source of the problem.

Disappearing Arrows or Signals

When using either the Spreadsheet System for Trading study or the Spreadsheet System/Alert study, when a formula in a cell in one of the Spreadsheet columns that is graphed on the chart, typically this is going to be Spreadsheet columns K, L, M, N, returns a nonzero or TRUE value, you will see an arrow on the corresponding bar on the chart representing the TRUE condition.

You also need to make certain that the Draw Style for the particular Spreadsheet formula column you want to see arrows for, is set to one of the Arrow Up/Down/Left/Right Draw Styles or other similar style.

These TRUE formula signals can trigger an Alert Sound as well and also a Trade signal (in the case of the Spreadsheet System for Trading study) if these signals are given in row 3, or row 4 if have set the study Input Signal Only On Bar Close (Columns K,M)/(Columns L,N-Z) to Yes.

If the formula no longer is returning a nonzero or TRUE value and instead returning FALSE (0), then the arrow will disappear even though the Alert and the Trade signal was previously given.

So it is important to understand that your formula could go to TRUE momentarily and then FALSE.

In summary, the standard Up and Down arrows on a chart displayed by these Spreadsheet studies, indicate the present state of the formulas. During the formation of a bar or after new bars are added to the chart, a formula could go from TRUE to FALSE based upon the logic of the formula and changing data in the cells that it references. It is up to you to determine specifically what is happening and why.

To actually see where the trades were made, you need to display Order Fills on the chart.

If you are using the Spreadsheet System for Trading study and you wish to visibly see where trades have been made on the chart in the case of when the arrows on the chart disappear, then enable Trade >> Show Order Fills. Various options affecting the display of order fills can be set by enabling Trade >> Chart Trade Settings on the menu.

When a cell that can trigger an Alert Sound or Trade signal becomes TRUE and an Alert Sound and/or a Trade signal is actually given, then an alert message will be added to the Window >> Show/Hide Alerts Manager >> Alerts Log. All of these events are logged in the Alerts Log tab.

Not only can you experience the condition where the arrows disappear, you could also have the condition where the state of your formulas change, based upon how they are programmed and the data they are referencing, and you see an arrow later appear on a bar where a signal was not previously given when it was evaluated for an alert or trade signal.

You may also see that the arrow direction does not correspond to an order fill displayed on a bar due to changes with the formula results during processing of a bar. For example, initially a bar may have given a Buy signal, a Buy fill is displayed on the chart for the bar, but then later the bar gives a Sell signal which is ignored based upon the auto trade logic. So at the present moment you see a Down Arrow, but a Buy fill for the bar.

In order to create more stability when it comes to generating orders when using the Spreadsheet System for Trading study, you may want to set the Signal Only On Bar Close (Columns K,M) / (Columns L,N-Z) input to Yes.

All of what is described in this section is something that you need to be aware of when you are looking at the final results of your trading system and comparing them to the current FALSE/TRUE state of the Spreadsheet formulas that you visually see at the present moment.

The Effect of the Number of Rows Input

The Number of Rows input with the Spreadsheet studies, affects the standard Up and Down arrows displayed on a chart by the Spreadsheet studies. You will need to increase this input value to see arrows going back more bars. Arrows that were placed on bars further back than the Number of Rows input during real-time updating and chart replays, can disappear, or if they have not been removed because there has not been a full recalculation of the study, they may no longer be valid.

Special Spreadsheet Outputted Values

The Spreadsheet studies will output additional values in the I and J Spreadsheet columns for information and calculation purposes. This is in addition to the main price graph data outputted to columns A through G and the study data outputted beginning at column AA.

The following is a list of all the additional values that are outputted.

Special Spreadsheet System for Trading Values

These values are outputted for the Spreadsheet System for Trading study only. These values can be used in Spreadsheet formulas. Below is a description of what each Row means.

Working Orders Quantity [Cell J3]

This is the combined quantity for all the Working orders for the chart symbol. This is positive for Buy orders and negative for Sell orders. If there is one Buy working order with a quantity of 5, it will be +5. If there is one Buy order and one Sell order, each with the same quantity, it will be 0.

Position with Working Orders Quantity [Cell J4]

This is the Position quantity combined with the quantities from Working orders. BuyEntry and SellEntry depend on this number to determine whether or not another entry should be allowed. For more information, refer to Trade Positions.

Position Quantity [Cell J5 or J8 ]

Cells J5 and J8 contain the Quantity of the current Trade Position for the chart symbol.

This Quantity can either be a quantity from the Trade Simulation Mode system or the quantity from the external trading service.

This depends upon whether the Spreadsheet System for Trading study is in Simulation Mode or not. For instructions to control this, refer to Going From Simulated Trading to Non-Simulated (Live) Trading.

This value can be negative (a Short quantity) or positive (a Long quantity). Both of these cells, J5 or J8, contain the same Position data and either one can be used.

In the case of a Trade Position Quantity when in Trade Simulation Mode, for information about how that is determined, refer to Simulated Trade Positions.

For information about non-simulated Trade Positions, refer to Trade Positions Tab.

Position with Working Exit Orders Quantity [Cell J6]

This is the Position quantity for the symbol combined with the quantity of working orders that can potentially exit the current Position. Therefore, if the Position quantity is +5 and there is a Sell order with a quantity of 4, this will be 1. For more information, refer to Trade Positions.

Prior Position Quantity [Cell J7]

The Prior Position Quantity cell indicates the Position Quantity right before a new order fill is processed. If a trade order fills with multiple fills, then this field will be updated for each of those fills.

Prior Position Quantity is calculated using the available order fill data in the Trade >> Trade Activity Log >> Trade Activity tab for the symbol. The Global Settings >> General Trade Settings >> Number of Days to Save in Trade Activity Log controls how many days of data are saved in the log. You may need to adjust that to meet your requirements.

Position Average Price [Cell J9]

This is the average of the fill prices of the currently open Trade Position for the Symbol and Trade Account the chart is set to.

For more information, refer to Trade Positions.

Open Profit/Loss [Cell J10]

This is the profit or loss of the currently open Trade Position for the Symbol and Trade Account the chart is set to.

For more information, refer to Trade Positions.

This value is outputted as a Currency Value. Refer to Position Profit/Loss for the calculation method for Currency Value.

Cumulative Closed Profit/Loss [Cell J11]

This is the profit or loss of the closed out trades for the Symbol and Trade Account the chart is set to and is based upon the available order fill data in Trade >> Trade Activity Log >> Trade Activity.

This value is outputted as a Currency Value. Refer to Position Profit/Loss for the calculation method for Currency Value.

If the order fills from Trades made, are not available in the Trade Activity Log, then the Cumulative Closed Profit/Loss value will not consider those trades. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

To reset this value, you will need to clear the order fill data from the Trade Activity Log for the Symbol and Trade Account. For instructions to do this, refer to Clearing Trade Activity Log.

The order fill data for replays and back tests, when you initiate a replay or back test will be automatically cleared. At that time you will receive a prompt to clear this data. When you press Yes, the data will be automatically cleared and therefore the Cumulative Closed Profit/Loss will be reset back to 0.

Maximum Open Position Profit [Cell J31]

The Maximum Open Position Profit is what the maximum profit of the current Position has been. This is reset whenever the Position Quantity changes. For more information, refer to Trade Positions.

Maximum Open Position Loss [Cell J32]

The Maximum Open Position Loss is what the maximum loss of the current Position has been. This is reset whenever the Position Quantity changes. For more information, refer to Trade Positions.

Win Trades [Cell J33]

The total number of winning trades based upon the available fill data in Trade >> Trade Activity Log >> Trade Activity. A winning trade is defined as a trade that reduces or closes out a Position while the Open Profit/Loss is positive or flat.

The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

Lose Trades [Cell J34]

The total number of losing trades based upon the available fill data in Trade >> Trade Activity Log >> Trade Activity. A losing trade is defined as a trade that reduces or closes out a Position while the Open Profit/Loss is negative.

The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

Total Trades [Cell J35]

The total number of closed trades based upon the available fill data in Trade >> Trade Activity Log >> Trade Activity. A trade is defined as a trade that reduces or closes out a Position. This is going to be an individual fill. Not necessarily an entire order.

The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

Seconds Per Bar - Intraday (read-only) [Cell J36]

This cell contains the number of seconds that the chart bars are set to (Chart>> Chart Settings ). This will always be a nonzero number. Even when one of the Number of Trades Per Bar, Volume Per Bar, Range Per Bar cells are nonzero.

Number of Trades Per Bar - Intraday (read-only) [Cell J37]

The cell contains the number of trades per bar setting in Chart>> Chart Settings. It will be zero if the chart bars are not set to be based upon a number of trades.

Volume Per Bar - Intraday (read-only) [Cell J38]

The cell contains the volume per bar setting in Chart>> Chart Settings. It will be zero if the chart bars are not set to be based upon a specified volume.

Range Per Bar (in ticks) - Intraday (read-only) [Cell J39]

The cell contains the range per bar setting in Chart>> Chart Settings. It will be zero if the chart bars are not set to be based upon a specified price range.

Symbol [Cell J40]

The cell contains the symbol of the chart. In the case where a Trade and Current Quote Symbol is set on the chart, that symbol will be returned.

Last Bar End DateTime [Cell J41]

This cell contains the latest date and time of the last bar in the chart in a Serial DateTime format.

This number can be used for various comparisons within formulas that are based on times. To ensure you see this value formatted as a Date-Time, right-click on the cell and select Number Format from the menu or Spreadsheet >> Number Format. Change the Number Format to Date-Time.

This cell data is outputted with all of the Spreadsheet studies.

Last Entry Trade Date-Time [Cell J42]

This cell displays a number that represents the Date and Time of the bar at which the last Entry trade was triggered and processed. This number can be used for various comparisons within formulas that are based on times.

This data is maintained by the internal Trades list in the chart.

Last Exit Trade Date-Time [Cell J43]

This cell displays a number that represents the Date and Time of the bar at which the last Exit trade was triggered and processed. This number can be used for various comparisons within formulas that are based on times.

This data is maintained by the internal Trades list in the chart.

Last Trade Profit/Loss [Cell J44]

This is the Profit or Loss of the last completed trade for the symbol. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

Closed Daily Profit/Loss [Cell J45]

This is the Profit or Loss of Trades made that have been closed during the day for the symbol. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default it resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Trade Service Account Balance [Cell J47]

This is the current cash balance for the selected Trade Account on the Trade Window for the chart when not in Trade Simulation Mode. This data is from the external connected Trading service. Not all Trading services provide this data. This is not a simulated account balance. To select the Trade Account on the Trade Window for the chart, refer to Selecting Trade Account.

Last Entry Fill Price [Cell J48]

This cell displays the fill price of the order for the last Entry trade. If your trading system is in simulation mode, then this data is from a simulated order. Otherwise, it is from a non-simulated order.

This data is maintained by the internal Trades list in the chart.

Last Exit Fill Price [Cell J49]

This cell displays the fill price of the order for the last Exit trade. If your trading system is in simulation mode, then this data is from a simulated order. Otherwise, it is from a non-simulated order.

This data is maintained by the internal Trades list in the chart.

Daily Win Trades [Cell J50]

This the number of trades that have completed and had a profit or were breakeven during the trading day. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field reset at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Daily Lose Trades [Cell J51]

This the number of trades that have completed and had a loss during the trading day. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Daily Total Trades [Cell J52]

This the number of Trades that have completed during the trading day. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

This field can be used to limit the number of automated trades during the trading day. For example, in the Disable Auto Trading (J28) cell, enter the following: =J52 >= 1. This will limit your automated trading to 1 trade per day.

Daily Total Quantity Filled [Cell J53]

This is the total quantity of the order fill quantities for the trading day. For example, if you have a buy order fill during the trading day of quantity 5 and a sell order fill of quantity 5, then this will be 10, assuming these are the only 2 fills during the trading day.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Daily Number of Long Trades [Cell J54]

This the number of Long Trades that have completed during the trading day. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Daily Number of Short Trades [Cell J55]

This the number of Short Trades that have completed during the trading day. This uses a Fill to Fill order fill grouping method for Trades.

This is calculated from the order fill data in Trade >> Trade Activity Log >> Trade Activity. The number of days saved in the Trade Activity Log is set through Global Settings >> General Trade Settings.

By default this field resets at midnight according to the Time Zone setting in Sierra Chart. The reset time can be changed through Global Settings >> General Trade Settings >> Daily Stats Reset Time.

Current Quote Values [Cells J12 through J20]

Cells J12 through J20 display the Current Quote Values for the chart symbol. These are always displayed on the Spreadsheet used by the Spreadsheet System for Trading study, and will only be displayed if the Output Current Quote Data input is set to Yes for the other Spreadsheet studies.

The Daily Open, Daily High, Daily Low, Daily Net (Daily Price Change), and Daily Volume are only going to be set when connected to the data feed (File >> Connect to Data Feed) and the associated chart is not replaying. Otherwise, they will be 0. The data that you see is the same data displayed in Window >> Current Quote Window. The Current Quote Window contains the daily quote data for the symbol of the active chart.

Tick Size [Cell J21]

This cell contains the Tick Size of the symbol. This is the minimum increment that the symbol trades in. This data is outputted for all of the Spreadsheet studies.

Special Spreadsheet Trading Inputs on the Spreadsheet

The following is a list of special Spreadsheet inputs in columns I and J used by the Spreadsheet System for Trading study. These are actual inputs that will use the values you type into the corresponding row in the J column.

Limit or Stop Prices [J22, J23, J24, J25]

Cells J22 through J25 allow you to set the Limit or Stop order prices for each of the 4 different Spreadsheet Order Actions. These apply when you have set to use a Limit or Stop order for a particular Order Action in cells J71 through J74. Refer to Buy Entry: Order Type [J71].

You are able to set a Limit or Stop price to either the Bid or Ask prices by using these formulas: =J12 (Bid price) or =J14 (Ask Price). This allows you to buy at the Bid or sell at the Ask respectively.

Order Quantity [J26]

Cell J26 controls the Order Quantity for orders that are submitted from the Spreadsheet System for Trading study. This quantity can be dynamically controlled by a formula.

If the cell is empty or 0, the Order Quantity will be set to 1 for Buy Entry and Sell Entry.

If the cell is empty or 0 during a Buy Exit or Sell Exit, then the quantity is determined by the automated trading logic and the end result will be that the Trade Position for the Symbol and Trade Account is flattened.

Negative order quantities are converted to positive numbers.

Use Separate Exit Order Quantity [J82]

When this cell is set to TRUE or a nonzero value, then a Buy Exit or Sell Exit Order Action will use the quantity specified by the Exit Order Quantity [J83] cell.

Exit Order Quantity [J83]

This cell is only used when Use Separate Exit Order Quantity [J82] is set to TRUE or a nonzero value.

This cell controls the Order Quantity for Buy Exit or Sell Exit Order Actions from the Spreadsheet System for Trading study. This quantity can be dynamically controlled by a formula.

If the cell is empty or 0 during a Buy Exit or Sell Exit, then the quantity is determined by the automated trading logic and the end result is that the Trade Position for the Symbol and Trade Account the automated trading system is for will be flattened.

Negative order quantities are converted to positive numbers.

Maximum Chase Amount for Limit Chase Orders [Cell J46]

This cell is used to specify the maximum chase amount for limit chase orders. For more information, refer to the Use Chase Orders input.

Cancel Working Orders [J27]

Cell J27 allows you to cancel all working orders for the Symbol and Trade Account of the chart that the Spreadsheet System for Trading study is currently applied to.

Setting this cell to TRUE or any non-zero number (such as 1) will trigger the canceling of orders. You can also input a formula into this cell to cancel all working orders when certain conditions are met.

The canceling of orders occurs before any of the Entry and Exit signal cells are evaluated. However, these cancellations in the case of non-simulated trading do take time to occur and they will be pending during the evaluation of the Entry and Exit signal cells.

When this cell is set to a nonzero or TRUE value, additional cancellations will not occur until it is set back to zero or FALSE and then back to a nonzero or TRUE value.

If you wish to cancel working orders at a specific time, then you can use a formula like this: =(J41-INT(J41)) > TIMEVALUE("16:15:00"). This example will return TRUE when the time is 16:15 or greater. Cell J41 is the latest time in the last bar in the chart. It is best to use that cell, since NOW() always refers to the current time, and that will not work during back testing.

Cancel All Orders except working Attached Orders [J78]

Cell J78 allows you to cancel all working orders except for working Attached Orders for the Symbol and Trade Account of the chart that the Spreadsheet System for Trading study is currently applied to.

Attached Orders that have a Pending Child - Client/Server status will still be canceled. Only Attached Orders that have an Open/Pending Open/Pending Modify status will not be canceled.

Setting this cell to TRUE or any non-zero number (such as 1) will trigger the canceling of orders. You can also input a formula into this cell to cancel all working orders when certain conditions are met.

The canceling of orders occurs before any of the Entry and Exit signal cells are evaluated. However, these cancellations in the case of non-simulated trading do take time to occur and they will be pending during the evaluation of the Entry and Exit signal cells.

When this cell is set to a nonzero or TRUE value, additional cancellations will not occur until it is set back to zero or FALSE and then back to a nonzero or TRUE value.

Flatten Position and Cancel Working Orders [J29]

Cell J29 flattens the existing Trade Position that the Spreadsheet System for Trading study is reporting on the Sheet. So this will be for the Symbol and Trade Account that the chart is set to.

All Working orders will also be canceled for the symbol and Trade Account.

Simply setting this cell to TRUE or any non-zero number (such as 1) will trigger the flattening of the Position and canceling of orders. You can also input a formula here to perform the action when certain conditions are met.

The flattening of the Position and canceling of orders occurs before any of the Entry and Exit signal cells are evaluated. When this cell is set to a nonzero or TRUE value, additional flattening of the Position and canceling of orders will not occur until it is set back to zero or FALSE and then back to a nonzero or TRUE value.

If you want to flatten the Trade Position and cancel working orders at a specific time, then you can use a formula like this: =(J41-INT(J41)) > TIMEVALUE("16:15:00"). This example will return TRUE when the time is 16:15 or greater. Cell J41 is the latest time in the last bar in the chart. It is best to use that cell, since NOW() always refers to the current time, and that will not work during back testing.

Disable Auto Trading [J28]

When Cell J28 is set to TRUE it disables all trading from the Spreadsheet. When this cell is set to TRUE, all Spreadsheet Buy/Sell entries and exits, flatten Position and cancel order commands are ignored.

However, if this cell is set to TRUE at the same time that a cell like Flatten Position and Cancel Working Orders is set to TRUE, then the Flatten Position and Cancel Working Orders action will still occur and then automated trading will be disabled after that. This paragraph applies to versions 1463 and higher.

You can enter a formula in this cell to disable trading when certain conditions are met or even when the latest Date-Time of the last bar in the chart meets some specified time condition. Manually setting this input to TRUE or any non-zero number will simply disable all auto trading until the cell is set back to FALSE.

If you want to disable automated trading at a specific time, then you can use a formula like this: =(J41-INT(J41)) > TIMEVALUE("16:15:00"). This example returns TRUE when the time is 16:15 or greater. Cell J41 is the latest time in the last bar in the chart. It is best to use that cell, since NOW() always refers to the current time, and that will not work during back testing.

For documentation for the particular Spreadsheet functions used, refer to Spreadsheet Functions.

To limit trading to the day session only, use this formula: =OR(J41-INT(J41) < TIMEVALUE("09:30:00"), J41-INT(J41) > TIMEVALUE("16:00:00") ). This formula assumes your time zone in Sierra Chart is set to New York, and the symbol of the chart is a stock or stock index.

Buy Entry: Order Type [J71]

This Spreadsheet input is for specifying the order type for the Buy Entry Order Action column.

It can be:

  • M = Market
  • L = Limit
  • S = Stop
  • SL = Stop-Limit

The corresponding Limit or Stop price is set in cell J22. If the Limit or Stop price cell is set to 0 or is blank, then the Limit or Stop price will be set to the current Ask price.

If the Order Type is blank, it will be set to M (Market).

The order type can be programmatically set with a formula. Here is an example: =IF($J$5 > 0, "L", "M").

Buy Exit: Order Type [J72]

This Spreadsheet input is for specifying the order type for the Buy Exit Order Action column.

It can be:

  • M = Market
  • L = Limit
  • S = Stop
  • SL = Stop-Limit

The corresponding Limit or Stop price is set in cell J23. If the Limit or Stop price cell is set to 0 or is blank, then the Limit or Stop price will be set to the current Bid price.

If the Order Type is blank, it will be set to M (Market).

The order type can be programmatically set with a formula. Here is an example: =IF($J$5 > 0, "L", "M").

Sell Entry: Order Type [J73]

This Spreadsheet input is for specifying the order type for the Sell Entry Order Action column.

It can be:

  • M = Market
  • L = Limit
  • S = Stop
  • SL = Stop-Limit

The corresponding Limit or Stop price is set in cell J24. If the Limit or Stop price cell is set to 0 or is blank, then the Limit or Stop price will be set to the current Bid price.

If the Order Type is blank, it will be set to M (Market).

The order type can be programmatically set with a formula. Here is an example: =IF($J$5 > 0, "L", "M").

Sell Exit: Order Type [J74]

This Spreadsheet input is for specifying the order type for the Sell Exit Order Action column.

It can be:

  • M = Market
  • L = Limit
  • S = Stop
  • SL = Stop-Limit

The corresponding Limit or Stop price is set in cell J25. If the Limit or Stop price cell is set to 0 or is blank, then the Limit or Stop price will be set to the current Ask price.

If the Order Type is blank, it will be set to M (Market).

The order type can be programmatically set with a formula. Here is an example: =IF($J$5 > 0, "L", "M").

Attached Order Target Offset (write only) [J80]

When this is set to a nonzero value, this will replace any existing defined Attached Orders on the Trade Window for the chart with a Target Limit order with the Offset specified in this cell.

The purpose of using a Spreadsheet cell to set the Target Attached Order Offset is so that it can be set according to a formula rather than hardcoded at a particular value on the Trade Window for the chart.

The Offset is relative to the parent order price. This Offset needs to be specified as an actual price value.

If a Stop order is also set through cell J81, then this will be added to the Attached Orders at the same time as well. For more information, refer to Attached Orders.

For the Attached Orders to actually be used when submitting a Buy/Sell Entry order, the Use Attached Orders option needs to be enabled on the Trade Window for the chart.

For additional information about using Attached Orders, refer to Initiating Trades with Auto-Trading and Using Manual or Attached Orders Exits.

Attached Order Stop Offset (write only) [J81]

When this is set to a nonzero value, this will replace any existing defined Attached Orders on the Trade Window for the chart with a Stop order with the Offset specified in this cell.

The purpose of using a Spreadsheet cell to set the Stop Attached Order Offset is so that it can be set according to a formula rather than hardcoded at a particular value on the Trade Window for the chart.

The Offset is relative to the parent order price. This Offset needs to be specified as an actual price value.

If a Target order is also set through cell J80, then this will be added to the Attached Orders at the same time as well. For more information, refer to Attached Orders.

For the Attached Orders to actually be used when submitting a Buy/Sell Entry order, the Use Attached Orders option needs to be enabled on the Trade Window for the chart.

For additional information about using Attached Orders, refer to Initiating Trades with Auto-Trading and Using Manual or Attached Orders Exits.

Working Orders Exist (read-only) [J84]

This is set to TRUE when there are orders which currently have a Status indicating they are working and can be filled. This also includes Pending Child orders. Otherwise, this is set to FALSE. This cell is read-only.

Allow Trading Only During Time Range (read/write) [J85]

This can be set to TRUE to only allow automated trading by the Spreadsheet System for Trading study during the time range specified in the Start Time For Allowed Time Range and End Time For Allowed Time Range cells.

Start Time For Allowed Time Range (read/write) [J86]

When the Allow Trading Only During Time Range cell has been set to TRUE, then this cell specifies the starting time in the charts time zone that automated trading is allowed to begin at.

End Time For Allowed Time Range (read/write) [J87]

When the Allow Trading Only During Time Range cell has been set to TRUE, then this cell specifies the ending time in the charts time zone that automated trading will no longer be allowed after.

Flatten Positions And Cancel Orders At Set Time (read/write) [J88]

When this cell is set to TRUE, then the current Trade Position will be flattened and any working Orders will be canceled for the Symbol and Trade Account of the chart the Spreadsheet System for Trading study is applied to, at the time specified by the Time For Flatten Positions And Cancel Orders cell.

Time For Flatten Positions And Cancel Orders (read/write) [J89]

When the Flatten Positions And Cancel Orders At Set Time cell is set to TRUE, then this cell specifies the time to flatten the Trade Position and cancel the Orders at.

Last Entry/Exit Order Date-Time (read-only) [J90]

This is the Date-Time in the charts time zone, of the last entry or exit order which was submitted whether it has filled or not.

This is useful to use in formulas to determine the amount of time elapsed since an order was submitted and it has not yet filled.

Back Testing

Refer to Auto Trade System Back Testing.

Spreadsheet Calculations and Spreadsheet Study Processing of Spreadsheet Data

This section describes the calculations of formulas on a Sheet in a Spreadsheet window and the subsequent reading and processing of values and formula results from a particular Sheet being referenced by one of the Spreadsheet studies. There is a difference between these two operations and this needs to be understood.

The general method by which a Spreadsheet study interacts with a particular Sheet in a Spreadsheet window (also known as a Sheet Collection), is that first the chart data and study values are outputted to the Sheet, the Sheet is calculated, and then the Spreadsheet study gets the results from the formula columns K through Z (last formula column by default) and processes those results and puts them into internal chart arrays for graphing on the chart.

In the case of the Spreadsheet System for Trading study, if there is a full recalculation of the chart, the Sheet will be updated and calculated, however there will not be processing of any of the Sheet formula columns during that full recalculation, by the Spreadsheet System for Trading study. A full recalculation will occur when the chart is opened as part of its Chartbook opening, studies are modified through the Chart Studies window, or if the chart has been tagged for a full recalculation by a chart it is referencing. This last case is not a common case.

After a full recalculation occurs, it is normal for the last bar in the chart to be calculated again. At this time it is normal for any of the Spreadsheet studies to process the formula columns for the last bar in the Sheet.

In the case of the Spreadsheet System for Trading study, if 100 or more bars are added at once to the chart when the chart is updated, then there will not be processing of the Sheet formula columns. This kind of event will be indicated in the Trade >> Trade Service Log when it happens.

The below sections explain how the K through Z formula columns that contain formula results are processed based on the Signal Only on Bar Close inputs. There are two of these inputs and this section applies to both of them. For example, if you use the Signal Only on Bar Close (Columns K, M) input, then this description would apply to columns K and M.

The time at which formula results are processed by any of the Spreadsheet studies is after all the Sheets within the Spreadsheet have been calculated and all cells are reporting their current values.

If Signal Only on Bar Close is set to No, then the following occurs:

If there are no new bars added to the chart during a chart update, then only Sheet row 3 is checked for TRUE/FALSE values that are returned by formulas in the Spreadsheet signal columns (K-Z).

If there are new bars added to the chart during a chart update, then the first row in the Sheet that is examined for TRUE/FALSE values that are returned by the formulas, is the previous topmost row during the prior update (the data previously at row 3).

The reason the previous topmost row is examined, is because there could be changes with the price data and studies at that row during the chart update. In other words, the examination continues where it left off.

Next, the Spreadsheet study processing function moves up the rows all the way up to 3, examining for TRUE/FALSE conditions row by row. For example, if there is one new bar added, then first row 4 is examined and then row 3 is examined for TRUE/FALSE conditions.

One potential issue to be aware of with this processing logic is that if a formula in a particular column is TRUE at row 3 and then a new bar is added and it becomes FALSE at row 4, then the internal state maintained by Sierra Chart for the Spreadsheet column goes to FALSE and can then go back to TRUE if the formula is TRUE at row 3 during that update.

The potential issue with this is an unexpected signal due to a state change.

If Signal Only on Bar Close is set to Yes, then the following occurs:

If there are no new bars added to the chart during a chart update, then only Sheet row 4 is checked for TRUE/FALSE values that are returned by formulas in the Spreadsheet signal columns (K-Z).

If there are new bars added to the chart during a chart update, then the first row in the Sheet that is examined for TRUE/FALSE values that are returned by the formulas, is the previous second topmost row during the prior update (the data previously at row 4).

The reason the previous second topmost row is examined, is because there could be changes with the price data and studies at that row during the chart update. Although, usually not in this case since the data was previously at row 4. In other words, the examination continues where it left off.

Next, the Spreadsheet study processing function moves up the rows all the way up to 4, examining for TRUE/FALSE conditions row by row. For example, if there is one new bar added, then first row 5 is examined and then row 4 is examined for TRUE/FALSE conditions.

One potential issue to be aware of with this processing logic is that if a formula in a particular column is TRUE at row 4 and then a new bar is added and it becomes FALSE at row 5, then the internal state maintained by Sierra Chart for the Spreadsheet column goes to FALSE and can then go back to TRUE if the formula is TRUE at row 4 during that update.

The potential issue with this is an unexpected signal due to a state change. Although, this kind of scenario is highly unlikely with Signal Only on Bar Close set to Yes because data other than at the last bar in the chart is not likely to change.

Order of Formula Column Processing and Internal Calculation Order

When the formula results in columns K through Z (last formula column by default) are processed for Trade Order or Alert signals by the Spreadsheet System for Trading or Spreadsheet System/Alert studies, column K is evaluated first, then L, then M, and so on through and including the last formula column (by default column Z). The last formula column is set by the Number of Formula Columns Input.

Therefore in the case of the Spreadsheet System for Trading study, the following columns are evaluated in the order in which they are listed left to right: Buy Entry, Buy Exit, Sell Entry, Sell Exit.

The order of calculation for the formulas in cells within a Spreadsheet is based upon the dependency they have to each other. A cell dependent on another cell is always going to be calculated after the cell it is dependent on.

In the case where 2 cells refer to each other, this is known as a circular reference. In the version of Sierra Chart with New Spreadsheets, there is no special handling of a circular reference, the result can be unpredictable, and an error may be given. Circular references are not supported as they simply make no mathematical sense and have an absolute impossibility to resolve accurately.

Multiple Exit Automated Trading Example

This is an example of an automated trading exit which utilizes two targets. This example applies to the Spreadsheet System for Trading study. A stop is not used in this example. There are three formulas involved in this strategy and they are used in the following cells: Buy Exit, Sell Exit, and Custom Order Quantity.

In this example, these formulas set a price target of 3 points and 5 points away from the Position Average Price (Cell J9). It is assumed that there is a Position quantity of 5.

For the first target, two contracts will be exited. For the second target, three contracts will be exited.

Order Quantity Formula (Cell J26): =IF( ABS(J8) = 5, 2, IF( ABS(J8) = 3, 3, 0)).

Buy Exit Formula (Cell L3): =OR( AND( $J$8 = 5, ID0.SG4@$3 - $J$9 > 3), AND( $J$8 = 3, ID0.SG4@$3 - $J$9 > 5))

Sell Exit Formula (Cell N3): =OR( AND( $J$8 = -5, $J$9 - ID0.SG4@$3 > 3), AND( $J$8 = -3, $J$9-ID0.SG4@$3 > 5))

This is merely a simple example and this will need to be tested and modified to be certain it will work for you.

Limiting Trading to Certain Time Ranges

This section uses the GETTIMEFROMDATETIMEVALUE function which is going to be available in an upcoming release at the time of this writing.

To restrict trading during only a certain time range, you can use the Disable Auto Trading cell. Here is an example formula to limit trading during a specific time range: =AND((GETTIMEFROMDATETIMEVALUE(J41)) > TIME(9,30,0), GETTIMEFROMDATETIMEVALUE(J41) < TIME(16,15,0)). J41 contains the Last Bar End DateTime.

Or this formula could be combined into a Buy Entry and Sell Entry formula by using the AND function.


*Last modified Saturday, 19th November, 2016.