Support Board
Date/Time: Sun, 09 Mar 2025 13:25:52 +0000
[Programming Help] - combining conditions help please
View Count: 529
[2022-03-06 16:03:48] |
User259724 - Posts: 43 |
Hello: I am trying to combine 2 conditions for a paint bar study. The first condition is ((ID1.SG1>ID1.SG1[-1]>ID1.SG1[-2]>ID1.SG1[-3]>ID1.SG1[-4])) which is a moving average rising over 4 consecutive bars, and the bars are painted correctly. The second condition is =and((ID1.SG1-ID1.SG1[-1])>(ID1.SG1[-1]-ID1.SG1[-2]),(ID1.SG1[-1]-ID1.SG1[-2])>(ID1.SG1[-2]-ID1.SG1[-3]),(ID1.SG1[-2]-ID1.SG1[-3])>(ID1.SG1[-3]-ID1.SG1[-4])) which is the difference of value of the moving average increasing from 4 bars ago to present. It also plots correctly. I am trying to combine both conditions as follows: =and (((ID1.SG1>ID1.SG1[-1]>ID1.SG1[-2]>ID1.SG1[-3]>ID1.SG1[-4]), and ((ID1.SG1-ID1.SG1[-1])>(ID1.SG1[-1]-ID1.SG1[-2]),(ID1.SG1[-1]-ID1.SG1[-2])>(ID1.SG1[-2]-ID1.SG1[-3]),(ID1.SG1[-2]-ID1.SG1[-3])>(ID1.SG1[-3]-ID1.SG1[-4]))) This does not plot any paint bars. Can anyone please correct my mistake? I have attached 2 screenshots of the same chart to make it easier to see what I am trying to accomplish. Thanks |
![]() Attachment Deleted. ![]() |
[2022-03-06 16:27:39] |
Sawtooth - Posts: 4181 |
If both conditions must be TRUE: =AND(AND(ID1.SG1>ID1.SG1[-1]>ID1.SG1[-2]>ID1.SG1[-3]>ID1.SG1[-4]),AND(ID1.SG1-ID1.SG1[-1]>ID1.SG1[-1]-ID1.SG1[-2],ID1.SG1[-1]-ID1.SG1[-2]>ID1.SG1[-2]-ID1.SG1[-3],ID1.SG1[-2]-ID1.SG1[-3]>ID1.SG1[-3]-ID1.SG1[-4])) If either condition is TRUE: =OR(AND(ID1.SG1>ID1.SG1[-1]>ID1.SG1[-2]>ID1.SG1[-3]>ID1.SG1[-4]),AND(ID1.SG1-ID1.SG1[-1]>ID1.SG1[-1]-ID1.SG1[-2],ID1.SG1[-1]-ID1.SG1[-2]>ID1.SG1[-2]-ID1.SG1[-3],ID1.SG1[-2]-ID1.SG1[-3]>ID1.SG1[-3]-ID1.SG1[-4])) |
[2022-03-06 16:39:16] |
User259724 - Posts: 43 |
Thank you so much. This works!!
|
To post a message in this thread, you need to log in with your Sierra Chart account: