Login Page - Create Account

Support Board


Date/Time: Sat, 01 Feb 2025 02:01:52 +0000



[Programming Help] - Need help with alert conditions.

View Count: 1086

[2019-06-16 17:31:57]
User929084 - Posts: 60
Hi, I'm trying to get alert using Color bar based on alert condition study. I have 3 conditions/ statements for the alert. However when I put all three of them together I don't get any signals, but if I use any combination of just two statements it works. It it that AND can only have 2 statements?

=AND(ID18.SG1[0] > ID18.SG1[-1],ID18.SG1[-1] < ID18.SG1[-2],(ID18.SG1 > ID18.SG2,(ID18.SG1<0))) <== Doesn't work, but that's the desired outcome

=AND(ID18.SG1[0] > ID18.SG1[-1],ID18.SG1[-1] < ID18.SG1[-2],(ID18.SG1<0)) <== Works

=AND(ID18.SG1[0] > ID18.SG1[-1],ID18.SG1[-1] < ID18.SG1[-2],(ID18.SG1 > ID18.SG2)) <== Works

I want to get a signal when MACD line crosses above MA of MACD, then MACD changes slope, all while MACD is still below 0 line.

Should I use another study for that or is my code just off a bit.

I attached img to clarify what I want to achieve.

Thank you.
image3alertconditions.png / V - Attached On 2019-06-16 17:27:52 UTC - Size: 2.08 KB - 258 views
[2019-06-17 18:14:37]
gayer2428 - Posts: 91
I don't understand the rationale for your use of parentheses in the first alert condition. As I see it, you just need one open parenthesis and a close parenthesis. It should work. See below.

=AND(ID18.SG1[0] > ID18.SG1[-1],ID18.SG1[-1] < ID18.SG1[-2], ID18.SG1 > ID18.SG2, ID18.SG1<0)
[2019-06-17 18:46:33]
User929084 - Posts: 60
That works. I don't have any coding experience, and I'm just starting with sierra chart and alerts. I learn as I go and dig deeper into capabilities of sierra chart.

Thank you.

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

Login

Login Page - Create Account