Study/Chart Alerts And Scanning


General Information

This page has information on the Simple Alerts feature in Sierra Chart. A more advanced alert and system feature is part of the Spreadsheet System/Alert study.

How do you know which alert feature to use? Start with the Simple Alert feature, and if it does not meet your requirements, then use the Spreadsheet System/Alert study. The Spreadsheet System/Alert study allows for larger formulas and more advanced logic.

A Simple Alert Condition Formula can be specified on a chart study or the main chart graph that will be continuously monitored. This alert Condition Formula can also be scanned for.

When an Alert Condition Formula becomes TRUE, an audible alert will be given if enabled, an exclamation mark (!) will be displayed in front of the study graph name, the study graph name will be highlighted as shown below, and a detailed message will be added to the Window >> Alerts Log. An email notification can also be sent.

SimpleAlertTrueExample

The color of the highlight is controlled through the Graphics Settings window. The specific color setting is Colors and Widths >> Alert Highlight Color.

When an Alert Condition Formula was TRUE on the previous formula evaluation, it is evaluated again and it continues to be TRUE, there will not be a new message added to the Alerts Log (Window >> Alerts Manager >> Alerts Log) or a sound played, if enabled. Only when the formula result transitions from FALSE to TRUE will there be a new alert message and sound. However, when the Alert Condition Formula is in a TRUE state, you will still see the Study Name that it is associated with, highlighted on the chart.

When using one of the Spreadsheet studies, or when using an Advanced Custom Study that uses the sc.SetAlert() function, then a Simple Alert Condition Formula entered directly on these studies is ignored. However, other studies on the chart and the main price graph can reference these studies in their Simple Alert Condition Formula.

Each study on a chart can have a Simple Alert Condition Formula and the main price graph can also have a Simple Alert Condition Formula.

When writing and testing a Simple Alert Condition Formula, if it is not TRUE on the last bar in the chart, then it may be hard to know whether it is working correctly. What we recommend is to use either the Color Bar Based on Alert Condition study or the Color Background Based on Alert Condition study and have it reference the study that contains the Simple Alert Condition Formula you are working on. In this way you can instantly and clearly see if your Alert Condition Formula works as expected because the bars will be colored at the bars where it is TRUE. Alert Condition Formulas can sometimes be complicated to resolve problems with. It's recommended that you use a step-by-step process to create a formula whereby you start simple and then add to it. The very first formula you should use to simply see how formulas work is =1 or =TRUE. This will color all of the bars in the chart, when using this study, and then you can go from there to a more advanced formula.

To Enter an Alert Condition on a Study

To enter an Alert Condition Formula on a study, you will need to create the Alert Condition Formula based upon the documented Alert Condition Formula Format and enter it into the Condition text box on the Alerts tab in the Study Settings window for the study. Refer to the image below.

Refer to the Modifying Study Settings section on the Chart Studies page for instructions to open the Study Settings window for a study.

For example Alert Condition Formulas, refer to the Examples section on this page.

The Spreadsheet System/Alert study and the Spreadsheet System for Trading study, do not support specifying an Alert Condition Formula or using the Alert options on the Alerts tab of the Study Settings window for these studies. The reason for this, is that the studies themselves have advanced alert functionality which is separate from the Alerts tab.

Study Settings

To Enter an Alert Condition on the Main Chart/Price Graph

To enter a Simple Alert Condition Formula on the main chart/price graph, select Chart >> Chart Settings >> Alerts from the menu. Enter the Alert Condition Formula using the documented Alert Condition Formula Format into the Alert Condition text box.

For an example alert condition, refer to the Simple Price Alert Example.

Chart Settings Alerts tab

Historical and Visual Evaluation of Alert Condition

It is supported to color the chart bars themselves, the background behind the bars, or place an up arrow or a down arrow above or below a bar, when an Alert Condition Formula becomes TRUE on the corresponding bar.

This will give you a visual indication of the Alert Condition Formula result and also allows you to see the Alert Condition Formula result applied to all of the historical bars in the chart.

It is also supported to color a study Subgraph at the chart column, where a particular Condition Formula is true.

To do this, use the Color Bar Based on Alert Condition study or the Color Background Based on Alert Condition study.

Alert Options

The following are the available options for Simple Alert Formulas.

Study Settings

Enabled

When the Enabled option is enabled, then the Alert Condition Formula will be evaluated and can trigger an alert signal. Otherwise, it is disabled.

Alert Only Once Per Bar

When the Alert Only Once Per Bar option is enabled, then when the Alert Condition Formula becomes TRUE, goes back to FALSE and becomes TRUE more than once when a bar is forming, only one alert signal will be given.

Even when this option is disabled, if an Alert Condition Formula becomes TRUE and remains TRUE during the formation of a bar, then there will only be one alert signal given.

Reset Alert Condition On New Bar

This option will cause the Simple Alert Condition Formula result to be reset back to FALSE when a new bar is added to the chart.

What this means is that if an Alert Condition Formula is currently evaluated as being TRUE, there is a new bar added to the chart, and if it evaluates to TRUE on a new bar, then you will get a new Alert Message and sound played (if enabled).

Otherwise, this will not occur because when an Alert Condition Formula is evaluated and the result is TRUE and the prior formula evaluation result was TRUE, there is no new Alert Message added or sound played.

Evaluate on Bar Close

This option will cause the Alert Condition Formula to be only evaluated on a closed bar. When this option is enabled, effectively what happens is that the Alert Condition formula is evaluated at every chart update, although it is only on the bar before the last bar in the chart.

Use Full Precision When Evaluating Alert Formula

The default for this option is disabled and it is recommended to keep it disabled. In this particular case The Effect of Value Format on Identifier Values applies.

Otherwise, the full precision is used in evaluation of the numbers in the Alert Condition Formula.

Selecting a Sound for the Alert and Email Notifications

You can specify an Alert Sound to be played when the Alert Condition Formula becomes TRUE by selecting an Alert Number 1-100 or None from the Alert Sound list box on the Alerts tab of the Study Settings window.

Or, in the case of an Alert Condition Formula set in Chart >> Chart Settings >> Alerts, select an Alert Number in the Alert Sound list box.

The specific sound file to play for a particular Alert Number is configured by selecting Global Settings >> General Settings >> Alerts from the menu. An email notification can be optionally set for the different Alert Numbers as well. For complete documentation, refer to Alert Sound Settings.

Alerts Log

All alerts are added to the Alerts Log. To view the Alerts Log, select Window >> Alerts Manager >> Alerts Log on the menu.

An alert message in the Alerts Log contains detailed information about the origin of the alert. In the case of Simple Alerts, the Alert Condition Formula will be contained within the alert message. You can control whether this window is automatically opened when an alert message is added. Select Global Settings >> General Settings, and enable/disable the Show Alerts Log on Study Alert option.

Customizing Messages in Alerts Log

To some extent it is possible to customize the alert messages from studies which are added to the Alerts Log. This is done by setting the Short Name for a study which is displayed on the alert message line in the Alerts log.

To set the Short Name open the Study Settings window for the study. On the Settings and Inputs tab set the Short Name.

If you want to have different custom alert messages for different alert conditions, you need to use separate studies, each with their own Alert Condition Formula.

Scanning

With Sierra Chart you are able to scan a list of symbols to see which ones where your Alert Condition Formula is TRUE. Follow the instructions below to do this.

Step By Step Instructions

  1. Enter the Simple Alert Condition Formula on a Study or the main price graph. Refer to the To Enter an Alert Condition on a Study section on this page for instructions to enter a Simple Alert Condition Formula on a study.
  2. Refer to the To Enter an Alert Condition on the Main Chart/Price Graph section on this page for instructions to enter a Simple Alert Condition Formula on the main price graph.
  3. Enter or import a list of symbols into the Associated Watch List ( Chart >> Associated Watch List) for the chart containing your Simple Alert Condition Formulas. These are going to be the symbols you want to perform the scan on.

    Follow the instructions in the Associated Watch List section on the Changing the Symbol of a Chart page for instructions to do this.

    You also have the ability to scan among all of the symbols that you have chart data files for and not use the Associated Watch List . If this is what you want to do, then skip this step and go on to the next step.
  4. Enable Global Settings >> General Settings >> General 2 >> Subscribe Real-time (RT) Data and Download Historical Data During Scan to ensure that the charts being scanned are up-to-date. Although in the case of Historical Daily charts, if a download has not been done for them in the last 24 hours, it will be done with this option on but the most recent real-time price data will not be added to the chart during the scan.
  5. To scan for symbols where your Simple Alert Condition Formula is TRUE among the list of symbols in the Associated Watch List for the chart or among all of the symbols you have data files for, refer to the Scan Menu Commands section.

Scanning Large Number of Intraday Charts

These are additional steps to perform when scanning a large number of Intraday charts for a TRUE condition returned from an Alert Condition Formula.

  1. Add symbols to Global Settings >> Intraday File Update List.
  2. Set Global Settings >> Data/Trade Service Settings >> Service to SC Data - All Services.
  3. Reconnect to the data feed. This will bring all the charts up-to-date. If you are subscribed to real-time data for the exchange, then they will be up-to-date to the real-time, otherwise the data will be delayed.
  4. Perform the scan. Refer to the Scan Menu Commands section.

Understanding Scanning Historical Daily Charts

When scanning through Historical Daily charts for a list of symbols, the evaluation of the Alert Condition Formula is always performed on the last bar in the chart. If a historical data download has to be done for the chart, and the new bar has not yet been added for the current date, there will be an evaluation done on what was the last bar in the chart before the download finishes.

Therefore, there will be 2 evaluations. The first evaluation of the Alert Condition Formula will be when the chart data is loaded and before the Historical Daily download completes. And then after the download completes another evaluation will be done. If a new bar has been added to the chart, this evaluation will be on the new bar.

When you look at the Window >> Alerts Manager >> Alerts Log, you can see what particular Date-Time the alert formula was evaluated on in the chart. Look at the Bar Start Date-Time text in the alert line.

It is also important to understand that if the last bar in the chart is changed by the Historical Daily download, the first evaluation could be TRUE but the second evaluation could be FALSE because the Alert Condition Formula is no longer TRUE after the data has changed in the last bar.

Therefore, to solve the above it is necessary to first download Historical Daily data for all of the charts in the Associated Watch List and then perform the scan after that is complete. Follow the procedure below.

  1. Go to the Historical Daily Chart you will be starting the scan on.
  2. Add the symbols to the Associated Watch List. Follow the instructions in the Associated Watch List section.
  3. Select Edit >> Download Daily Data for Associated Watch List Symbols.
  4. Wait for the download to finish.
  5. Run the scan again. Refer to the Scan Menu Commands section for instructions. At this point in time, the scan will be performed on the most recent data since the Historical Daily data download has been done before the scan.
  6. Select Window >> Alerts Manager >> Alerts Log for the results.

Applying your Alert Condition Formulas To Other Charts by Using Study Collections

Once you have set up your studies and set up your Alert Condition Formulas on one or more of those studies, you can easily apply that configuration to other charts by using Study Collections. Save your set of studies which contain the Alert Condition Formulas, as a Study Collection. For instructions, refer to the Study Collections documentation.

If an Alert Condition Formula is entered on a study and that study is saved as part of a Study Collection, then every chart the Study Collection is applied to will use that same Alert Condition Formula. To use unique Alerts on charts where you apply a Study Collection, then do not enter Alert Condition Formulas on the studies before you will be saving them as a Study Collection. Enter the Alert Condition Formulas on the study or studies after applying the Study Collection to a chart.

Evaluation of Alert Condition Formulas

Alert Condition Formulas set on a Chart or a Study are evaluated/calculated when the chart is updated. This is according to the Chart Update Interval.

Therefore, it is possible some very fast price movement can be skipped in between evaluations.

Alert Condition Formula Format

Formula Format Overview

The formatting and evaluation of a Simple Alert Condition Formula is designed to work similar to formulas you use in Sierra Chart Spreadsheets. This is like the Excel formula format. This means you can use any of the same Spreadsheet formula operators and available Spreadsheet Functions in your Simple Alert Condition Formula.

With Simple Alerts, typically the only Spreadsheet Functions you would be using will be the OR() and the AND() functions. If your Simple Alert Condition Formula involves times and dates, then you may need to use the Time and Date related functions as well. Refer to the Examples.

The Simple Alert Condition Formula usually begins with an equals sign (=). Although it is not necessary to use the =. All of our examples will use the =. Example: =[formula]. [formula] is replaced with the actual formula. Example: = C >100 .

When entering numbers and formulas, keep in mind to use the proper delimiters in your numbers and formulas, according to the English (US) region. The numbers in the examples shown here, use the "." delimiter as the decimal separator. The delimiter used for parameters (arguments) for Spreadsheet functions is a ",". These are both based upon the English (US) region.

Numbers

These are the possible formats for number constants:

  • Integer: Integer value. Example: 10
  • Floating-point value: Floating-point value. Example: 10.5
  • Fractional Format: Integer + numerator/denominator. Example: 120+20.5/32

Operators

The following standard operators can be used in the alert condition:

Conditional Operators
OperatorOperationExample
= equal to 4 = 4
<> not equal to 4 <> 6
< less than 4 < 6
<= less than or equal to 6 <= 6
> greater than 6 > 4
>= greater than or equal to 4 >= 4
Logic Operators
OperatorOperationExample
! Not !(1 = 2)
Arithmetic Operators
OperatorOperationExample
+ addition 6 + 2 = 8
- subtraction 6 - 2 = 4
* multiplication 6 * 2 = 12
/ division 6 / 2 = 3
^ exponent (to the power of) 6 ^ 2 = 36

All of the above examples return a TRUE value.

In addition to all of the above operators, remember that you are able to use all of the available Spreadsheet Functions because Alert Condition Formulas are based upon the same formula evaluator which is used with Sierra Chart Spreadsheets.

OR and AND Functions

When you want to combine multiple Alert Condition formulas into a single formula, this can be done by using the OR an AND functions. The documentation linked to below shows examples.

An Alert Condition formula can refer to other studies on the same chart. Refer to Referencing Other Studies on the Chart.

An Alert Condition formula can indirectly refer to studies in other charts. Refer to Referencing Studies on Other Charts.

In the case where there is a very elaborate and long Alert Condition formula that you require, you may want to consider using the Spreadsheet System/Alert study to break it up into multiple formulas and to overcome the formula length limitation for Simple Alert formulas.

Available Main Price Graph Identifiers

To reference data from the main price graph (This is the price graph in Chart Region 1) and other related data for the symbol, use the following identifiers:

  • BARDATE = The Date of the bar as a SCDateTime type.
  • BARTIME = The Time of the bar as a SCDateTime type.
  • BARDATETIME = The Date and Time of the bar as a SCDateTime type.
  • O = Bar Open
  • H = Bar High
  • L = Bar Low
  • C = Bar Close/Last
  • V = Bar Volume
  • OI = Open Interest of the bar
  • NT = Number of Trades of the bar
  • OHLC = Average of Open, High, Low, and Close of the bar
  • HLC = Average of High, Low, and Close of the bar
  • HL = Average of High and Low of the bar
  • BV = Bid Volume of the bar
  • AV = Ask Volume of the bar
  • SG22 = This is the Renko Open value for Renko bars and can be used in an Alert Condition Formula on the chart itself. For an Alert Condition Formula for a study, the identifier needs to be ID0.SG22 assuming there are no other studies acting as the base graph in the chart.
  • SG23 = This is the Renko Close value for Renko bars and can be used in an Alert Condition Formula on the chart itself. For an Alert Condition Formula for a study, the identifier needs to be ID0.SG23 assuming there are no other studies acting as the base graph in the chart.
  • DAILYHIGH = Daily High. Refer to Footnote 1.
  • DAILYLOW = Daily Low. Refer to Footnote 1.
  • LASTTRADESIZE = Last Trade Size. Refer to Footnote 1.
  • BID = Bid Price. Refer to Footnote 1.
  • ASK = Ask Price. Refer to Footnote 1.
  • LASTTRADE = Last Trade Price. Refer to Footnote 1.
  • PREVIOUSDAYCLOSE = Previous Day Close. Refer to Footnote 1.
  • TICKSIZE = This is equal to the Tick Size set in the Chart Settings window for the chart.

By default these identifiers will be set to their value at the current/last bar in the chart. They can reference any bar relative to the current bar. To do this, refer to Referencing Data Other Than on the Last Bar/Column In the Chart.

Footnote 1: These identifiers will have values of zero unless the Symbol of the chart is valid and Sierra Chart is connected to the real-time data feed. When replaying a chart, LASTTRADESIZE, BID, ASK, LASTTRADE will be set and valid. During a chart replay DAILYHIGH, DAILYLOW, PREVIOUSDAYCLOSE will be 0. The data for all of these identifiers can be viewed in the Window >> Current Quote Window. All of these identifiers reference current values only and do not support the [] array operator to reference previous values.

Examples

= C > 1000

= C[-1] > ID1.SG1

Special Functions

  • VAP(Price, Offset)
    Returns the total Volume at the given Price on the bar at the given Offset from the current calculation bar. Returns #VALUE! if the given Price is not a number, or if the given Offset could not be interpreted as an integer value. Returns #N/A if the given Offset is beyond the range of the bars.

    For example, VAP(1000.5, 0) returns the Volume for the 1000.5 price at the chart bar index being evaluated. VAP(1000.5, -1) will return the Volume for the the prior chart bar from the one being evaluated.

    Main price graph identifiers can be used within the parameters. For example: VAP(H, 0). You can access other price levels relative to the high by using this formula: VAP(H - (TICKSIZE * 1), 0). Change the * 1 any other number to reference additional price levels below the High.

    When using a main price graph identifier together with an offset, like VAP(L, -1), the offset does not affect how the main price graph identifier is evaluated. VAP(L, -1) will return the Volume of the prior bar at the low price of the current bar. To get the Volume of the prior bar at the low price of the prior bar, that would be VAP(L[-1], -1).
  • BVAP(Price, Offset)
    Returns the Bid Volume at the given Price on the bar at the given Offset from the current calculation bar. Returns #VALUE! if the given Price is not a number, or if the given Offset could not be interpreted as an integer value. Returns #N/A if the given Offset is beyond the range of the bars.

    For example, BVAP(1000.5, 0) returns the Bid Volume for the 1000.5 price at the chart bar index being evaluated.

    Main price graph identifiers can be used within the parameters. For example: BVAP(H, 0). You can access other price levels relative to the high by using this formula: BVAP(H - (TICKSIZE * 1), 0). Change the * 1 any other number to reference additional price levels below the High.
  • AVAP(Price, Offset)
    Returns the Ask Volume at the given Price on the bar at the given Offset from the current calculation bar. Returns #VALUE! if the given Price is not a number, or if the given Offset could not be interpreted as an integer value. Returns #N/A if the given Offset is beyond the range of the bars.

    For example, AVAP(1000.5, 0) returns the Ask Volume for the 1000.5 price at the chart bar index being evaluated.

    Main price graph identifiers can be used within the parameters. For example: AVAP(H, 0). You can access other price levels relative to the high by using this formula: AVAP(H - (TICKSIZE * 1), 0). Change the * 1 any other number to reference additional price levels below the High.

Referencing Study Subgraphs

To reference the data of one of the study's own Subgraphs (These are the Subgraphs of the study the Alert Condition Formula is applied to), use the identifier SG# where the # is the number of the Subgraph.

For example, SG1 is the first Subgraph, and SG4 is the 4th Subgraph.

The actual numbers of the Subgraphs that are available with the study, are displayed on the Subgraphs tab of the Study Settings Window for the study. Refer to the image below.

These identifiers will be set to the value of the Subgraph at the last bar/column in the chart. These Subgraph identifiers can make reference to other bars/columns in the chart, refer to Referencing Data Other Than on the Last Bar/Column In the Chart.

If you reference a Subgraph (SG#) that is not used, the Alert Condition Formula will not be evaluated.

Subgraph Identifiers

Examples

= SG1 > 40

Referencing Other Studies on the Chart

Screenshot

To reference a Subgraph from another study on the same chart in an Alert Condition Formula, start the identifier with ID#. where the # is the unique identifier of the study. Follow this with a "." and then the identifier of the Subgraph (SG#. Example: ID1.SG1) you want to reference from that study.

For example, ID2.SG1 references the first Subgraph of the study with ID: 2. The unique study IDs for all of the studies on the chart are displayed in the Studies to Graph list on the right side of the Chart Studies window.

These identifiers can also be written as ID:#. ID:2.SG1 is the same as ID2.SG1. If you reference the unique ID of a study that does not exist, the Alert Condition Formula will not be evaluated.

The delimiter used in these study Subgraph references is the ".". It will always be a ".".

It is possible to access the main underlying price graph in this way by using ID0. So to access the closing price at the bar being processed by the Alert Condition Formula, you would specify ID0.SG4. Where SG1 = Open, SG2 = High, SG3 = Low, SG4= Last/Close.

One concept to understand is that If you require an Alert Condition which involves multiple studies, then you will put it on one of the studies and that formula through Study Subgraph identifiers (Example: ID2.SG1) will make reference to the other studies.

Example

=AND(ID3.SG1 > 0 , C > ID8.SG1)

Referencing Studies on Other Charts

To reference a study or studies on other charts in an Alert Condition Formula, it is first necessary to overlay those studies from other charts onto the chart where the Alert Condition Formula is located. To do this, you need to use the Study/Price Overlay study to overlay those studies.

Once you have overlaid the the study or studies on to the chart where the Alert Condition Formula is located, you then need to follow the method described in Referencing Other Studies on the Chart, to reference the data in the Study/Price Overlay study in the Alert Condition Formula.

Referencing Data Other Than on the Last Bar/Column In the Chart

To access the data from a bar/column in the chart other than the current bar, with any of the Main Price Graph and Study Subgraph identifiers described in this section, you need to include an offset within square brackets after the Main Price Graph or Study Subgraph identifier.

For example, H[-1] will be set to the High value 1 bar prior to the current bar, SG1[-3] will be set to the value of the first Subgraph three bars prior to the current bar, and ID2.SG1[-4] will be set to the value of the first Subgraph of the study with ID 2 four bars prior to the current bar.

If no offset is given for an identifier, that is equivalent to an offset of zero. For example, SG1 is equivalent to SG1[0].

If the Alert Condition Formula references a bar that does not exist, the Alert Condition Formula will not be evaluated.

In the description above, current bar refers to the last bar in the chart when evaluating an Alert Condition Formula on a study other than the Color Bar/Background Based on Alert Condition study. It will refer to the bar before the last bar the chart when Evaluate on Bar Close is enabled.

When using the Color Bar/Background Based on Alert Condition study, current bar refers to the bar currently being evaluated by this study. This study evaluates an Alert Condition Formula on historical bars.

Using Positive Bar Reference Offsets and Consequences

It is also possible to use a positive number within the square brackets (ID1.SG1[1]) to reference data for chart bars which are after the chart bar the Alert Condition Formula is being evaluated on.

For example, you could specify H[1] which will reference the bar High price one bar forward. This would only be meaningful if you are using the option Evaluate on Bar Close or you are using the Color Bar/Background Based on Alert Condition study.

In either of these cases, the formula will be applied to bars other than the last bar in the chart. So using a positive reference would be useful. Otherwise, you would be referencing data beyond the end of the chart which normally does not exist. Although, there are consequences to using a positive reference.

The consequence of using a positive offset within the square brackets to reference data after the last bar in the chart is that during real-time updating of the chart or during a replay, the data being referenced will not exist and your Alert Condition Formula will evaluate to FALSE and you will not get an Alert or the new bars added to the chart will not be colored in the case of when using the Color Bar/Background Based on Alert Condition study.

Referencing Data Beyond the Last Bar in the Chart

There are cases where it does make sense to reference chart columns beyond the last bar in the chart. One example would be to reference the data from the Pullback Column of the Numbers Bars Calculated Values study.

You need to be running the current version of Sierra Chart for support for this.

To reference the Pullback Column column data, simply use the study Subgraph identifier for the particular Subgraph you want to reference and follow it by [1]. Example: SG1[1].

The Effect of the Value Format on Identifier Values

All study and main price graph identifiers O, H, L, C, SG1, ID1.SG1, ... are converted to values which correspond to the Price Display Format/Value Format setting on the main price graph or study that the identifier belongs to.

Therefore, the Price Display Format setting for the chart will affect the O, H, L, C identifiers. The Value Format setting on a study will affect the ID#.SG# identifiers for that same study.

This conversion takes place before the formula is evaluated. In other words the value will be as you see it on the chart.

For example, if internally a Moving Average value at a chart bar is 841.2351 and the Value Format for that particular study is .1, then this will be converted to 841.2. So the value is rounded. So 841.25 would be rounded to 841.3 if the Value Format for the study is .1.

Another example, if a Study Subgraph at a specific chart bar is 0.001, at another chart bar the Study Subgraph is 0.004, in the Value Format for the study is 0.01, then 0.001 and 0.004 will be considered equal because 0.001 rounds to 0.00 and 0.004 rounds to 0.00. Therefore, you can see the importance of the Value Format setting on the evaluation of formulas.

Main price graph values are rounded according to the Price Display Format setting in Chart >> Chart Settings. This is the main chart equivalent to the Value Format setting.

The application of the Value Format does not occur when using the CROSSOVER(), CROSSFROMABOVE(), or the CROSSFROMBELOW() functions. The numbers are represented as they actually internally are with full precision.

If your Alert Condition formula is not giving an expected result, then it is possible that the Value Format setting is not correct.

You will need to increase the number of decimal places in the Value Format for greater precision. Be aware, that a less precise Value Format setting can create unexpected comparison results which do not correspond to what you visually see on the chart with the Study Subgraph drawings.

Writing Formulas for Studies without Obvious Values

There are some Study Subgraphs like the Candlestick Patterns Finder >> Pattern # Subgraph and the Zig Zag >> Text Labels Subgraph which do not have obvious values because these are just displayed as text.

However, in each of these cases the Study Subgraph which is used to control the color and Font Size contain values which correspond with the particular text displayed.

In the case of the Zig Zag study, it is necessary to set the Additional Output for Spreadsheets study Input to Yes for some of these additional study Subgraphs to contain values.

To see these study Subgraph values you need to use the Chart Values Tool and the Tool Values Window.

When you move the Pointer over a particular chart bar, you will see displayed in the Tool Values Window the value for each of the Subgraphs at that chart bar. Refer to the image below for this.

So this is a method that you can determine to values for a Study Subgraph that do not have obvious values.

You can then write a formula to use these values. For example SG1>0.

Alert Formula Examples

Some of the examples below provide Study Collection files. To use a Study Collection file, refer to Using a Study Collection for step-by-step instructions.

When an example says to add a study to the chart, refer to the Adding/Modifying Studies documentation for instructions if needed.

The below Simple Alert Condition Formulas can be used with studies or on the main price graph depending upon what they are designed to do.

To enter one of these formulas on a study, refer to To Enter an Alert Condition on a Study.

To enter one of these formulas on the main price graph of the chart, refer to To Enter an Alert Condition on the Main Chart/Price Graph.


  1. Stochastic Alert: Add the Stochastic-Slow study to the chart. Enter the =CROSSOVER(SG1, SG2) formula into the Alert Condition text box on the Alerts tab of the Study Settings window for the study. When the %K line crosses the %D line an alert will be given. Enter the =AND(CROSSOVER(SG1, SG2), SG1 > 70) formula into the Alert Condition text box on the Alerts tab of the Study Settings window for the study. With this formula, when the %K line crosses the %D line and %K is above 70, then an alert will be given.
  2. Simple Price Alert: Enter =C > 50 into the Alert Condition text box on the Chart >> Chart Settings >> Alerts tab for the chart. This formula means if the close is greater than 50, then give an alert.
  3. Moving Average Crossover Alert: Add the study Moving Averages to the chart. The study will display three moving averages. Open the Study Settings window for the study. Configure the Inputs as you require. On the Subgraphs tab set the Draw Style moving averages you do not want to see to Ignore. In the Alert Condition text box on the Alerts tab enter: =CROSSOVER(SG1, SG2). This means if the first two moving averages cross, an alert will be given.
  4. Moving Average Crossover Alert Using Separate Moving Averages: Add 2 Moving Average studies to the chart. Configure the studies as you require. Take note of the ID number of each study as it is displayed in the Studies to Graph list box on the Study Settings window.

    Select one of the Moving Average studies and open the Study Settings window for that study. In the Alert Condition text box on the Alerts tab, enter: =CROSSOVER(ID1.SG1, ID2.SG1). This means if the moving average with ID1 crosses the moving average with ID2, then an alert will be given. If you apply this formula to the study with ID1, then ID1. can be removed and instead you can just use SG1.
  5. To Scan For Charts With Increasing Volume: Add a Moving Average study to the chart. Open the Study Settings window for the study. Set the Input Data input to Volume. Set the Chart Region setting to 2. Enter =SG1 > SG1[-5] into the Alert Condition text box on the Alerts tab for the study. This formula means if the Moving Average value on the last column/bar is greater than the Moving Average value five columns/bars prior, then give an alert. Select Chart >> Start Scan on the menu to scan all your data for this condition. The number 5 in the bars back operator ([-5]) can be set to whatever you require.
  6. Alert at Specific Time: If you want to get an alert at a specific time, use a formula like this: =AND(BARTIME >= ((09*60+30)/(24*60)), BARTIME <= ((09*60+31)/(24*60))). This will give you an alert when the time 9:30 to 9:31 occurs on the last bar.
  7. Highlighting the Evening Session Background: If you want to highlight the background of the chart for the evening session trading, then use the Color Background Based on Alert Condition study and use the following Formula: =OR(BARTIME >= ((15*60+30)/(24*60)), BARTIME <= ((8*60+30)/(24*60))), this will color the bars from 15:30 to 8:30.

    There is a better way to perform the same function rather than using this formula. Use the Time Range Highlight study.
  8. Simple Alert Condition Formula for Change of Slope of a Study Subgraph Line: To get an alert when a study Subgraph line changes its slope, then use this Simple Alert Condition Formula: =OR(AND(SG1[0] > SG1[-1],SG1[-1] < SG1[-2]),AND(SG1[0] < SG1[-1],SG1[-1] > SG1[-2])). This formula is meant for study Subgraph 1. This will work fine for any of the Sierra Chart Moving Average studies.
  9. Simple Alert Condition Formula for Change of Slope or New Slope of a Study Subgraph Line: To get an alert when a study Subgraph line changes its slope or there is a new slope after a flatline, then use this Simple Alert Condition Formula: =OR(AND(SG1[0]>SG1[-1],SG1[-1]<=SG1[-2]), AND(SG1[0]<SG1[-1],SG1[-1]>=SG1[-2])). This formula is meant for study Subgraph 1.
  10. Color Bar Formula To Color Bars Based On Whether Study Subgraph Is Above Or Below 0: These formulas need to be used on the Color Bar Based on Alert Condition study. You need two instances of this study. This formula assumes that the study we are referencing has an ID of 1 and we are referring to the first Subgraph of that study. Simple Alert Condition Formulas: =ID1.SG1>0, =ID1.SG1<0.
  11. Making an Alert Condition Formula Function During Certain Times: In this example the alert will only function between 5:30 and 22:20. =AND((Your alert Condition Formula),BARTIME >= ((05*60+30)/(24*60)), BARTIME <= ((22*60+20)/(24*60)))
  12. Alert for TICK-NYSE chart when it crosses these levels: -600, -1200 and +600, +1200. =OR(CROSSOVER(C,-600),CROSSOVER(C,-1200),CROSSOVER(C,600),CROSSOVER(C,1200)). Enter this alert in Chart >> Chart Settings >> Alerts in the Alert Condition box.
  13. Alert for Commodity Channel Index (CCI) when it crosses -180, -200 and +180, +200: =OR(CROSSOVER(SG1,-180),CROSSOVER(SG1,-200),CROSSOVER(SG1,180),CROSSOVER(SG1,200)). Enter this alert in the Study Settings window for the Commodity Channel Index study in the Alert Condition box.
  14. Alert for Commodity Channel Index (CCI) when it crosses its Line 2 or Line 3 Subgraphs: =OR(CROSSOVER(SG1,SG3),CROSSOVER(SG1,SG4)). Enter this alert in the Study Settings window for the Commodity Channel Index study in the Alert Condition box.
  15. Slow Stochastic Crossover: This Study Collection file, when applied to a chart, will place a green up arrow at the price bar where the stochastic %K line crosses the stochastic %D from below. It will place a red down arrow at the price bar where the stochastic %K line crosses the stochastic %D from above. The Study Collection uses 2 Color Bar Based on Alert Condition studies. Study Collection file: SlowStochasticCrossoverAlert.StdyCollct
  16. Alert when Moving Average Crosses Bar Close Price: This Study Collection file, when applied to a chart, will place a green up arrow at the price bar where the bar Close price crosses a Moving Average from below. It will place a red down arrow at the price bar where the bar Close price crosses a Moving Average from above. The Study Collection uses 2 Color Bar Based on Alert Condition studies. Click on the following link to download the Study Collection file: MovingAverageAndLastCrossoverAlert.StdyCollct. For complete instructions to use this Study Collection, refer to Using Study Collections.
  17. Alert when New High or New Low of Day: This Study Collection file, when applied to a chart, will provide you with an Alert when there is a new high or new low that has occurred during the trading day. This Study Collection uses the Daily OHLC study. Click on the following link to download the Study Collection file: New High New Low Alert.StdyCollct. For complete instructions to use this Study Collection, refer to Using Study Collections.
  18. Alert When High or Low of a Chart Bar Intersects Keltner Bands: This Study Collection file, when applied to a chart, will provide you with an Alert when the High or Low of a chart bar intersects or goes beyond the Keltner Bands. Click on the following link to download the Study Collection file: Keltner Alert.StdyCollct. For complete instructions to use this Study Collection, refer to Using Study Collections.
  19. Alert When Moving Average Within Range of Price Bar: Enter the following Alert Condition Formula on a Moving Average study: AND (H >= SG1,L <= SG1).
  20. Alert When Moving Average Crosses over Close Price of Bar: Enter the following Alert Condition Formula on a Moving Average study: =CROSSOVER(SG1, C).
  21. Alert When Moving Average Crosses over Price Bar: Enter the following Alert Condition Formula on a Moving Average study: =OR(CROSSOVER(SG1, H) , CROSSOVER(SG1, L)).
  22. Alert When there is a gap between Close and Open of Price Bars (Close of previous bar is different from next bar Open): Enter the following Alert Condition Formula on the Main Price Graph: =C[-1] <> O. The O is the letter 'O' for open and not zero.
  23. Formula To Detect Chart Bar Within Study Bands: The following Simple Alert Condition Formula can be used with studies like the Moving Average Envelope to detect when the chart bars enter within the bands of the study. : =OR(AND(H <= ID1.SG1, H >= ID1.SG2) , AND(L <= ID1.SG1, L >= ID1.SG2) , AND(H > ID1.SG1, L < ID1.SG2)).

  24. Alert Formula For When Difference Between All 3 Study Subgraph Lines is Less than Chart Tick Size: =AND(ABS(SG1-SG2) < TICKSIZE, ABS(SG2-SG3) < TICKSIZE).
  25. Alert Formula For When Study Subgraph Crosses 0: The following Simple Alert Condition Formula can be used for any study: =CROSSOVER(SG1, 0). This checks for when the first study Subgraph crosses 0.
  26. Alert Formula For When 2 Study Subgraphs Cross: The following Simple Alert Condition Formula needs to be entered on one of the studies: =CROSSOVER(ID#.SG1, ID#.SG1,). ID# needs to be changed to the study ID of the study being referred to. For information about study IDs, refer to Referencing Other Studies on the Chart.
  27. Formula to Detect Swing High and Low: The following Simple Alert Condition Formula is for the Swing High and Low study when its Length input is set to 2. This will provide an alert whenever there is a Swing High or Low. Formula: =OR(SG1 > 0, SG2 > 0, SG0[-1] > 0, SG1[-1] > 0, SG0[-2] > 0, SG1[-2] > 0, SG0[-3] > 0, SG1[-3] > 0).
  28. Alert Formula for When Bar Close Price Crosses over Top or Bottom Bollinger Band: The following Simple Alert Condition Formula needs to be entered on the Bollinger Bands study: =OR(CROSSFROMBELOW(C,SG1),CROSSFROMABOVE(C,SG3)). This formula will give an alert when the bar closing price crosses from below the Top Band to above the Top Band or crosses from above the Bottom to below the Bottom Band. You may optionally want to enable the Evaluate on Bar Close option on the Alerts tab of the Study Settings window.
  29. Alert for Volume Greater Than Certain Volume : Enter =V > 10000 into the Alerts tab of the Chart Settings window. Change 10000 to the volume number that you require. Refer to To Enter an Alert Condition on the Main Chart/Price Graph.
  30. Alert for Bar Time Duration Equal to Specific Time: Enter the following formula into the Alerts tab of the Bar Time Duration study: =AND(SG1 > TIME(0, 4, 59), SG1 < TIME(0, 5, 1)). This will provide an alert when the time of a bar is five minutes. Since Date and Time values are imprecise floating-point values requires that we check for a range of up to one second on either side of five minutes. For this formula to work correctly it is necessary the Value Format setting for the study is set to Time. Reference: TIME Spreadsheet Function.
  31. Moving Average Crossover With Arrows: This is an example which uses Alert Condition Formulas and Color Bar Based on Alert Condition studies to draw Up and Down arrows on the price bars when long and short length Moving Average-Exponential studies cross. Click the following link to download the Study Collection file: MovingAverageCrossoverWithArrows. For complete instructions to use this Study Collection, refer to Using Study Collections.
  32. Ask Volume Bid Volume Difference Alert: Enter the following formula into the Alerts tab of the Bid Volume versus Ask Volume study: OR(SG5 < -100, SG5 > 100). This formula will provide an Alert when the difference between Ask Volume and Bid Volume is greater than 100 or less than -100. Modify the number 100 to use a different trigger value.
  33. Alert when Chart Bar is Within Specified Ticks of Touching Bollinger Bands: Enter the following Alert Condition Formula on a Bollinger Bands study: =OR(H >= SG1 - (4 * TICKSIZE), L <= SG3 + (4 * TICKSIZE)). In this particular case the specified number of ticks is 4 and can be modified as required.

*Last modified Friday, 09th December, 2016.