Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 20:41:30 +0000



Looking for a Simple Formula in an Alert that

View Count: 2529

[2014-10-12 00:53:47]
JayShea - Posts: 92
says that even if all conditions are true but it was also true in either of the two previous bars, it is NOT true and will not create an alert signal.

I'm hoping the request was not stated in too convoluted a syntax.

Thanks
JD
[2014-10-12 01:31:03]
Sawtooth - Posts: 4120
Here's how to reference previous bars:

http://www.sierrachart.com/index.php?page=doc/doc_AlertCondAndScan.html#ReferencingDataOtherLastBar


[2014-10-12 03:14:39]
Sierra Chart Engineering - Posts: 104368
Let us know if you need more help.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-10-12 15:44:15]
JayShea - Posts: 92
While I'm always grateful for help from the ever-generous Tom Gilb, I'm afraid either my question exceeds the information contained in Tom's link, or I'm not smart enough to interpret what's right in front of me.

My alerts all currently use referenced previous bars and I'm comfortable with that information. I'm looking for more. The Oliver Twist of SierraChart.

For example: Let's say H>ID1.SG3[-2] triggers an alert. Let's also say the same formula on the next bar triggers the same alert. I don't want either the visual or auditory signal the second time. If I do or don't act on the first alert, I don't need to be distracted on the next bar or the one after that.

I'd like a formula that says: If the Alert was triggered on the Previous Bar and Conditions are True for the Alert on the Current Bar, I don't want the Alert on the Current Bar because I got it on the Previous Bar. Have I over-complicated the question?

Thanks
JD
[2014-10-12 18:18:00]
vegasfoster - Posts: 444
You can use an if statement and refer to the previous bar for the alert conditions, for example two moving averages as ID1 and ID2 and a colorbar based upon alert condition as ID3, can highlight color if ma1 greater than ma2 with ID1.SG1>ID2.SG1, but could also highlight the first cross and ever bar after with =if(ID3.SG1[-1]=1, 1, if(AND(ID1.SG1[0]>ID2.SG1[0], ID1.SG1[-1]<=ID2.SG1[-1]), 1, 0)). In the second formula, it is first evaluating whether the previous bar is true or not before calculating the current bar. You can use this basic concept in combination with multiple alert studies to create states that hold true until some other condition is met. That said, if it starts getting complicated and your head start spinning, then you are better off going to a spreadsheet.
[2014-10-12 20:38:42]
Sawtooth - Posts: 4120
Try this:

=AND(H[-1]<ID1.SG3[-3],H>ID1.SG3[-2])

This will only alert on the first occurrence, for as long as the condition remains TRUE.

Write the formula so that the previous bar is FALSE, and the current bar is TRUE.

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

Login

Login Page - Create Account