Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 09:31:28 +0000



[User Discussion] - 2 conditions, alerted only once each

View Count: 698

[2021-09-21 16:21:13]
adam czuk - Posts: 25
Hey Sierra, I love the platform. Hoping you could help me out with this...

What I'm trying to do is get an alert when a bar touches one of two moving averages. For this I used a simple study alert on ONE of those moving averages, and instructed it to detect if the moving average is within the range of the current bar. My code looks like below as indicated between the # characters, where ID9 and ID10 are the moving avg studies..

#=OR(AND (H >=ID9. SG1,L <= ID9.SG1) ,AND (H >= ID10.SG1,L <= ID10.SG1))#

The issue is that a moving average fluctuates as the bar develops and often the average will repeatedly "peek" inside that bars range, then back.. causing the study to alert multiple times within an hour which is kind of annoying.

"alert only once per bar" fixes this somewhat, but I won't be notified when the second moving average is hit on that bar.

**What I'm trying to do is tell sierra to alert me only twice per bar, once for the 1st moving avg and once for the 2nd.**

I realize I could split it into two separate alerts, but am trying to do it in one because I have to switch these alerts on and off for multiple charts, which takes more time than toggling just one alert formula.
[2021-09-21 20:58:00]
Sawtooth - Posts: 3952
I realize I could split it into two separate alerts, but am trying to do it in one because I have to switch these alerts on and off for multiple charts, which takes more time than toggling just one alert formula.

You would need to separate the alert conditions, one on each of the MAs (or on any two studies).

Or you can do it with the Spreadsheet System/Alert study, where each alert formula would be in its own spreadsheet Formula Column.

Also, if all of your charts are in the same chartbook, you could use one cell on one sheet to enable/disable all alerts on all charts.

Post again if you want details.
Date Time Of Last Edit: 2021-09-21 21:00:00
[2021-09-23 10:52:39]
adam czuk - Posts: 25
Yes I would like details
[2021-09-23 13:07:16]
Sawtooth - Posts: 3952
Add the Spreadsheet System/Alert study:
On the Settings and Inputs tab (not the Alerts tab):
- Give it a name in the Spreadsheet Name field.
- Check 'Hide Study'.
- Set the 'Alert Only Once Per Bar' to Yes.
- If required, set 'Reset Condition On New Bar' to Yes.
- Set the Column K Alert for the ID9 MA.
- Set the Column L Alert for the ID10 MA.
Click OK and OK.
Formulas on the spreadsheet:
Cell H1: Enable alerts: (1/0)
Cell H2: 1
Cell K3: =AND($H$2,C3>=ID9.SG1@3,D3<=ID9.SG1@3)
Cell L3: =AND($H$2,C3>=ID10.SG1@3,D3<=ID10.SG1@3)

To apply this to other charts:
- 'Save Single' a Study Collection of this study after checking "Prompt To Remove Existing Studies'.
- Apply the Study Collection to each chart, choosing No when asked to remove existing studies.
- Then on each chart's sheet, put this formula in H2:
=Sheet1!H2
where the original sheet was Sheet1; edit as required.
This assumes all charts have MAs at ID9 and ID10.

Notes:
- H1 is the title for H2.
- You only edit H2 on the original sheet#.
- To disable all alerts, edit H2 to 0.
- Any non-zero value in H2 will enable all alerts.
- The original Sheet# will be at the top of the list of sheets in the dropdown in the upper left corner.
- By default, the Sheet# corresponds to the Chart#.
- Be sure to use the Study Collection you made so that the correct settings are applied to each.
- Ignore the default column titles in K2-N2. You can edit these on the original sheet# if you want.
Date Time Of Last Edit: 2021-09-23 13:19:07
[2021-09-23 15:44:24]
adam czuk - Posts: 25
Thank you very much Tom!

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account