Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 13:25:57 +0000



[Programming Help] - coding help;

View Count: 572

[2021-12-08 20:47:55]
User259724 - Posts: 43
I am new to writing code. If I have a condition, for example, that a close be higher than 2 moving averages, that would be and(c>ID1.SG1, c>ID2.SG1) where ID1.SG1 and ID2.SG1 are the 2 moving averages. If I want to have the condition, for example, that a close be higher than either moving average, that would require an "or" condition. How would I write this?
Thanks for any replies.
[2021-12-08 20:53:52]
Sawtooth - Posts: 4179
=OR(C>ID1.SG1, C>ID2.SG1)
[2021-12-08 21:06:01]
User259724 - Posts: 43
Thank you for your reply. What I actually wanted to do was to combine several "and" conditions with an "or" condition. For example close above 2 moving averages (as above) and a close greater than h[-1] or h[-2]. How would I write this? Thanks for any replies.
Date Time Of Last Edit: 2021-12-08 21:11:38
[2021-12-08 21:22:04]
Sawtooth - Posts: 4179
=AND(C>ID1.SG1, C>ID2.SG1),OR(C>H[-1], C>H[-2]))

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

Login

Login Page - Create Account