Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 03:35:26 +0000



[Programming Help] - Syntax / Formula Help!

View Count: 1034

[2019-01-04 17:39:07]
stocknerd1 - Posts: 10
Hello, I have a few conditions that i want to all be true and alert and I am getting a syntax error. Here's what I have

=AND((ID6.SG1 - ID1.SG1) >= 1.5, (ID4.SG1 - ID1.SG1) >= 1),
AND(ID4.SG1 > ID3.SG1, ID1.SG1 > ID2.SG1),
AND((ID2.SG1 - ID3.SG1) >= 0.25, (ID4.SG1 - SG1) < 1),
AND((ID4.SG1 - SG1) > 0)

I've kind of tested the syntax by wrapping the whole thing in an OR() function from reading the documentation and it works fine w/ no syntax error but I am wanting all of the conditions to be True.
What is the syntax to string these AND() functions together or how could I accomplish this?
Thank you in advance for your time.
[2019-01-04 17:56:33]
Sawtooth - Posts: 3993
You can make it clearer if you eliminate the intermediate ANDs and their parentheses, and put each condition on its own line:

=AND(
ID6.SG1 - ID1.SG1 >= 1.5,
ID4.SG1 - ID1.SG1 >= 1,
ID4.SG1 > ID3.SG1,
ID1.SG1 > ID2.SG1,
ID2.SG1 - ID3.SG1 >= 0.25,
ID4.SG1 - SG1 < 1,
ID4.SG1 - SG1 > 0)
[2019-01-04 18:43:15]
stocknerd1 - Posts: 10
Thank you for the quick reply! I am trying this and im still getting a syntax error. I dropped the multiple AND()'s and dropped the parentheses for the conditions with subtraction, its written just like what you posted and still getting this error unfortunately. Tried it again with the parentheses for the subtraction operator before the greater than / lesser than and still have the Syntax error. Any thoughts?
[2019-01-04 18:45:36]
stocknerd1 - Posts: 10
I just had the thought that the input may be white space sensitive so i cleared and typed it up so far so good. Thank you for your fast and helpful answers @tomgilb
Date Time Of Last Edit: 2019-01-04 18:46:25
[2019-01-04 22:52:53]
Sawtooth - Posts: 3993
I personally never use spaces in my formulas. I didn't test the formula, sorry.
[2019-01-05 03:17:03]
stocknerd1 - Posts: 10
Hey no problem at all I really appreciate your responses and help thank you bud!

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

Login

Login Page - Create Account