Support Board
Date/Time: Mon, 16 Jun 2025 20:43:11 +0000
[Programming Help] - Help with syntax for (Color Background Based on Alert Condition).
View Count: 897
[2022-09-19 05:11:49] |
2garin - Posts: 188 |
Good day. There are two conditions: AND (ID2.SG2[-1]=ID1.SG2[-1], ID2.SG2=ID1.SG2, ID2.SG2>2, ID2.SG1=ID1.SG1=0) and ID2.SG2<1 When writing conditions to the indicator separately, the Background is marked correctly. I want to write down a condition under which the alert (Background) turned on on the first condition and continued until the second condition appeared (the area is marked with black lines). The expression only marks the first bar =IF (AND (ID2.SG2[-1]=ID1.SG2[-1], ID2.SG2=ID1.SG2, ID2.SG2>2, ID2.SG1=ID1.SG1=0), 1, IF ( ID2.SG2<1, 0, 0)) |
[2022-09-19 16:32:51] |
Sawtooth - Posts: 4227 |
You must create a persistent TRUE until the second condition, like this: =IF (AND (ID2.SG2[-1]=ID1.SG2[-1], ID2.SG2=ID1.SG2, ID2.SG2>2, ID2.SG1=ID1.SG1=0), 1, IF ( ID2.SG2<1, 0, ID3.SG1[-1])) where ID3 is the Color Background study. |
To post a message in this thread, you need to log in with your Sierra Chart account: