Login Page - Create Account

Support Board


Date/Time: Tue, 04 Mar 2025 22:09:16 +0000



[Programming Help] - coding help, combining conditions

View Count: 613

[2022-01-01 19:32:21]
User259724 - Posts: 43
I am trying to combine 2 conditions.
The first is volume greater than 100, and volume greater than twice the previous bar volume.
I am using on a colour bar alert "= and (v>100, v>v[-1]*2)" which colours the correct bars on the chart.
The second is close in the top 80% of the range.
I am using on a colour bar alert "=and (c>((0.8*(h-l)+l)))" which colours the correct bars on the chart.

Trying to combine the 2 conditions I am using "=and ((v>100, v>v[-1]*2), (c>((0.8*(h-l)+l))))" which does not work. I have tried different bracket orders, movements, etc

Can someone please show me what is not correct.

Thanks in advance for any replies.
[2022-01-01 20:19:00]
Bet_More_Tim - Posts: 21
Not sure, but I think you need to pop another 'and' word in for your nested ands

"=AND(AND(v>100, v>v[-1]*2),(c>((0.8*(h-l)+l))))"

without the extra AND, the whole "(v>100, v>v[-1]*2)" is viewed as one argument by the AND function, but it's nested, so it needs an AND function also

I think that'll do it
[2022-01-01 20:59:44]
User259724 - Posts: 43
Thank you very much. This works! Much appreciated.

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

Login

Login Page - Create Account