Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 22:34:15 +0000



[Programming Help] - Alert on first trigger after a condition is present

View Count: 538

[2023-01-04 18:46:48]
DKtrades - Posts: 39
Is there a way to limit an alert to only trigger once after a condition is met?

Example:

I have two moving average studies on a chart: 50EMA (eg ID1.SG1) and 200EMA (ID2.SG1).

I would like an alert where:

1. 50EMA crosses under 200EMA (ID1.SG1 < ID2.SG1)
2. Price is below the 50EMA and has gapped away (H[-1] < ID1.SG1)
3. Price touches the 50EMA (H > ID1.SG1)

I have this formula setup successfully for an alert based on "Color Bar Based on Alert Condition".

But -- can it be setup so that it only triggers the first time after the condition is true? Ie, it won't trigger again until after the 50EMA crosses back *over* the 200EMA and then crosses back *under* again.

I can't find documentation that would help me achieve this. Any help much appreciated.
[2023-01-04 19:07:38]
User183724 - Posts: 183
there are a couple options on the Alert tab...down under the Alert Condition window...

Alert Only Once per Bar

Disable Simple Alert After Trigger

would either of those do what you want?

otherwise you'll have to include a condition in the alert itself (if price is higher than the alert condition then = false kind of thing)
[2023-01-05 03:49:24]
Sawtooth - Posts: 4122
Try this:
=AND(ID1.SG1<ID2.SG1,CROSSFROMBELOW(H,ID1.SG1))
[2023-01-05 09:09:52]
DKtrades - Posts: 39
Alert Only Once per Bar

Disable Simple Alert After Trigger

would either of those do what you want?

Not for the first one, but I'm investigating the second. Unfortunately there is no Documentation for this option (I don't know for example how it is 'reset' after it is disabled).

I do have a manual workaround (switch studies once I get the first alert, and have a separate alert for the EMA crossover to switch it back on).

Would be great though for an alert to be able to "trigger" activation of another alert (eg, the EMA crossover triggers the re-test/touch alert to be active), and then for it to be only evaluated as true for one time, and then to remain inactive until the trigger condition is met again.

Try this:
=AND(ID1.SG1<ID2.SG1,CROSSFROMBELOW(H,ID1.SG1))

Thanks for the simpler formula, it's much appreciated. I'm getting more used to them (finally worked out how to use the Study/Price Overlay Study, which helps me limit alerts to the trend on my higher timeframe).

I will raise a separate support issue about the missing documentation.

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

Login

Login Page - Create Account