Color Bar Based On Alert Condition


Color Background Based on Alert Condition

Refer to the Color Bar Based on Alert Condition section below.

Color Bar Based on Alert Condition

The information in this section applies to both the Color Bar Based on Alert Condition and Color Background Based on Alert Condition studies.

In almost all cases you will want to use the Color Bar Based on Alert Condition study since its Subgraphs >> Draw Style can also be set to Background and accomplish the same thing as the Color Background Based on Alert Condition study.

These are very powerful studies that color the bars, Study Subgraph lines, or the chart background according to whether or not the specified Simple Alert Condition Formula is TRUE for the corresponding bar.

Up/Down Arrows can also be drawn as an alternative. For complete information on how to define and set a Simple Alert Condition formula to be used with this study, refer to the Study Alerts and Scanning page.

There are many Formula Examples on that page including examples which use this study.

The Simple Alert options for an Alert Condition formula: Reset Alert Condition on New Bar, Alert Only Once per Bar, do not apply with this study.

The option Evaluate on Bar Close does apply to these studies. In the case of the Color Bar Based on Alert Condition and Color Background Based on Alert Condition studies, Evaluate on Bar Close does not cause the prior bar to be colored when the Alert Condition formula is TRUE at a specific bar, rather it simply skips evaluating the formula on the very last bar in the chart. In other words, when Evaluate On Bar Close is enabled, what effectively does is evaluate the Alert Condition Formula across the bars in the chart other than the last bar. So when it is disabled, the evaluation also occurs on the last bar in the chart.

One good use of this study is to test a Simple Alert Condition formula you have been using on a study. In this way you can instantly and clearly see if your Alert Condition formula works as expected because the bars or background will be colored at the chart bars where it is TRUE.

Alert Condition formulas can sometimes be complicated to resolve problems with. It is 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 this study and how formulas work is =1 or =TRUE. This will color the bars or background in the chart and then you can go from there to a more advanced formula.

Remember that if you want to make reference to other studies in your Alert Condition formula, that you must specify the study's ID before the study Subgraph you are referencing. Example: ID1.SG2

Drawing Arrows or Other Styles at the High or Low of Bars

It is possible to draw Arrows or other Draw Styles at the High or Low of a chart bar instead of coloring the entire bar itself. Follow the instructions below to do this.

  1. Add the Color Bar Based on Alert Condition study to the chart. Refer to the Adding/Modifying Studies for instructions.
  2. Open the Study Settings window for the study.
  3. Select the Alerts tab and set an Alert Condition Formula to do what you require.
  4. Select the Settings and Inputs tab.
  5. Set the Output When Condition Is True Input with the study to Use Input Data.
  6. Set the Input Data Input to High or Low.
  7. Select the Subgraphs tab.
  8. Set the Draw Style for the Color Bar Subgraph with this study to the style that you want.
  9. Select the Settings and Inputs tab.
  10. Optionally set the Draw Style Percentage Offset Input to the +/- percentage offset that you want to offset the arrow or whatever Draw Style you have used, from the Input Data you have set.
  11. Press OK.
  12. Press OK.

Coloring Subgraphs of Other Studies

Using the Color Bar Based on Alert Condition study, you are able to color the Subgraphs of other studies on the chart based upon the specified Simple Alert Condition formula. Below are the general steps to accomplish this.

  1. Add the study you want a custom color to the chart. For instructions, refer to the Adding/Modifying Studies section.
  2. Add the Color Bar Based on Alert Condition study to the chart.
  3. Use the Down button on the Chart Studies window to move the Color Bar Based on Alert Condition study you have added to below the study that you want to custom color, in the Studies to Graph list.
  4. Set the Chart Region for Color Bar Based on Alert Condition study to the same Chart Region as the study you want to custom color.
  5. Set the Based On setting to the study you want to custom color.
  6. Set the Output When Condition Is True Input to Use Input Data.
  7. Set the Input Data Input to the Subgraph in the study you want to custom color.
  8. Select the Subgraphs tab.
  9. Set the Draw Style of the Color Bar Subgraph to be the same as the Subgraph of the other study you are coloring. In the case where you are coloring a study Line, it is recommended to use the Line-Skip Zeros Draw Style. Otherwise, the appearance of the line will not be correct.

Hiding Studies

Other studies on the chart that you reference with the Color Bar Based on Alert Condition study may only be used for the purpose of coloring the main price graph bars when your Alert Condition Formula is true. You may not need to visually see the original source studies.

Therefore, you will want to hide those studies. To do this, go into the Study Settings window for each of those studies. On the Settings and Inputs tab, enable Hide Study option.

Preventing Alert Sounds and Alert Log Messages

If you do not want to have Alert Sounds played or Alert Log messages added when the Alert Condition Formula is TRUE at the last bar in the chart when using one of these Color Bar Based/Background on Alert Condition studies, then follow the instructions below.

  1. Open the Study Settings window for the Color Bar Based/Background on Alert Condition study. Refer to Adding/Modifying Chart Studies for instructions.
  2. Select the Alerts tab on the Study Settings window.
  3. Uncheck the Enabled option. Unchecking this option will not affect the coloring of chart bars but will prevent messages from being added to the Window >> Alerts Manager >> Alerts Log and prevent alert sounds from being played.
  4. Press OK.
  5. Press OK.

Inputs

Below are descriptions of the available Inputs for this study.

  • Use Vertical Line Instead of Coloring Background: This input only applies to the Color Background Based on Alert Condition study. When it is set to Yes, then an additional Subgraph is used and a vertical line with a width specified by the Subgraphs >> Background >> Width setting is drawn instead of coloring the background completely behind the chart bar.
  • Number of Bars to Calculate: This Input specifies how many bars in the chart, starting from the end of the chart, the Simple Alert Condition formula should be tested with and colored if the formula is TRUE on that bar. The reason for this Input is that if you have a lot of bars loaded in the chart, this study can take some time to evaluate the Simple Alert Condition formula on all those bars and it will slow Sierra Chart. So you want to keep this to a small number. Maybe not more than 2000. You will have to experiment and see what is best and what you need.
  • Use -1 on False: This input only applies to the Color Bar Based on Alert Condition study. Normally the value for the Subgraph data elements is zero when the Alert Condition formula is FALSE for bars. When this Input is set to Yes, then the value is -1. This is for special use to perform coloring when using certain Draw Styles.
  • Output When Condition Is True: This input only applies to the Color Bar Based on Alert Condition study. When an Alert Condition formula is TRUE at a bar/column in the chart, the corresponding study Subgraph element of this study which is used to color a bar is set to 1.0. This causes the bar to be colored when using one of the Color Bar Draw Styles.

    When you set this Input to Use Input Data, then the study Subgraph element for this study at the bar/column where the Alert Condition formula is TRUE, will be set to the value of the Input Data Input at that bar. It is necessary to use Use Input Data when you want to use a Draw Style other than the boolean Draw Styles such as Color Bar. The other styles require an actual chart value to vertically position them on the chart.

    Setting this to Use Input Data, also allows you to color existing studies when your Alert Condition formula is TRUE. This requires that the Color Bar Based on Alert Condition study be Based On the study that you want to color.
  • Input Data: This input only applies to the Color Bar Based on Alert Condition study. When Output When Condition Is True: is set to Use Input Data, then this Input specifies the specific Main price graph Subgraph or study Subgraph to use. This will be the value that the Subgraph element of this study is set to at the corresponding bar/column in the chart.
  • Draw Style Percentage/Ticks Offset: This input only applies to the Color Bar Based on Alert Condition study. When the Output When Condition Is True Input is set to Use Input Data, then this Input specifies the percentage or number of ticks from the Input Data value that the outputted value will have.

    Whether this is a percentage or number of ticks is dependent upon the Draw Style Offset Type Input setting.

    This is useful to offset a particular Draw Style. This value can to be positive or negative.
  • Draw Style Offset Type: This input only applies to the Color Bar Based on Alert Condition study. This controls whether the Draw Style Percentage/Ticks Offset is a Percentage or Number of Ticks according to the chart Tick Size.

*Last modified Saturday, 10th September, 2016.