Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 18:26:38 +0000



Some more alert help please...

View Count: 250

[2024-02-06 19:30:36]
User666015 - Posts: 49
Hi all,

I have been trying for a couple of hours without success to make an alert for when two EMA lines crossover - but only when within a certain tick range of a VWAP line, I've tried every combination of ANDs and ORs that I can think of but the alert goes off when the EMAs crossover whether within the tick range of the VWAP line or not. Here's what I've come up with:

=AND(CROSSOVER(ID1.SG1, ID8.SG1), (OR(C>=ID14.SG1-TICKSIZE*4,C<=ID14.SG1+TICKSIZE*4)))

Where am I going wrong please?

Thanks,
Bill
[2024-02-06 20:19:40]
cmet - Posts: 551
Here's a long form not using the crossover with individual long and short. Might help help you out. I'm assuming ID14 is your VWAP.

Long:

AND(ID1.SG1 > ID8.SG1, ID1.SG1[-1] < ID8.SG1[-1], ID1.SG1 >= ID14.SG1 + 4*TICKSIZE)

Short:

AND(ID1.SG1 < ID8.SG1, ID1.SG1[-1] > ID8.SG1[-1], ID1.SG1 <= ID14.SG1 - 4*TICKSIZE)
[2024-02-06 20:53:12]
User719512 - Posts: 264
The key to debug your alert formula is breaking down the pieces and ensuring each piece works.
Does CROSSOVER(ID1.SG1, ID8.SG1) work as expected?
Does C>=ID14.SG1-TICKSIZE*4 work as expected?

Then you can see you need to tweak that part to be more like what cmet posted.
AND(C<ID14.SG1, C>=ID14.SG1-TICKSIZE*4)

^^ this might be correct based on my assumptions of your intended alert. If not, it should put you on the correct path.

Then your original solution might work as:
AND(CROSSOVER(ID1.SG1, ID8.SG1), OR(AND(C < ID14.SG1, C>=ID14.SG1-TICKSIZE*4), AND(C > ID14.SG1, C<=ID14.SG1+TICKSIZE*4)))

Note, you can use multiple lines in alert formulas, but the dialog is small for that sometimes but can help readability.
AND(CROSSOVER(ID1.SG1, ID8.SG1),
OR(AND(C<ID14.SG1, C>=ID14.SG1-TICKSIZE*4),
AND(C>ID14.SG1, C<=ID14.SG1+TICKSIZE*4)
)
)

Date Time Of Last Edit: 2024-02-06 20:53:43
[2024-02-07 16:57:39]
User666015 - Posts: 49
Thank you both for your expert help, and the help explaining where I am going wrong!

I now have some time to test these approaches and incorporate into my charts.

Cheers,
Bill

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

Login

Login Page - Create Account