Support Board
Date/Time: Wed, 12 Feb 2025 15:23:31 +0000
[Programming Help] - Alert Settings
View Count: 1238
[2020-10-19 19:11:07] |
User923291 - Posts: 27 |
I am seeking to create an alert (using color bar based upon alert condition) for when the slope (SG1) of the moving average (ID8) changes from negative to positive. I have tried the following and received error messages. Can you please advise of a correct formula to achieve this? Thank you. (ID8.SG1.0)/(ID8.SG1.-1)>1 (ID8.SG1.0)>(ID8.SG1.-1) |
[2020-10-19 19:38:05] |
Sawtooth - Posts: 4173 |
See examples #8 and #9: Study/Chart Alerts And Scanning: Alert Formula Examples |
[2020-10-19 20:50:27] |
User923291 - Posts: 27 |
Thank you. I am now trying to create an alert for when all three signals apply to a single bar and am receiving error messages for the language below. Can you please advise on what might work for this? Thank you. = (AND(ID2.SG1+ID2.SG2>0)) AND(CROSSFROMBELOW(ID1.SG1, ID1.SG2)) AND(ID8.SG1 > ID8.SG1[-1]) =(ID2.SG1+ID2.SG2>0) AND(CROSSFROMBELOW(ID1.SG1, ID1.SG2)) AND(ID8.SG1 > ID8.SG1[-1]) (ID2.SG1+ID2.SG2>0) AND(CROSSFROMBELOW(ID1.SG1, ID1.SG2)) AND(ID8.SG1 > ID8.SG1[-1]) =AND(AND(ID2.SG1+ID2.SG2>0)) , AND(CROSSFROMBELOW(ID1.SG1, ID1.SG2)) , AND(ID8.SG1 > ID8.SG1[-1]) |
[2020-10-19 20:56:07] |
User923291 - Posts: 27 |
Reviewed Study/Chart Alerts And Scanning: Alert Formula Examples and tried several other iterations including AND{(ID2.SG1+ID2.SG2>0) , (CROSSFROMBELOW(ID1.SG1, ID1.SG2)) , (ID8.SG1 > ID8.SG1[-1])} Still getting error messages. I look forward to your response. |
[2020-10-19 21:07:38] |
Sawtooth - Posts: 4173 |
None of your formulas match the examples 8 & 9 in the documentation. It also appears you are not using the correct syntax. Please take a closer look at the entire documentation on alerts: Study/Chart Alerts And Scanning It is not clear exactly what you now want to do, so it's difficult to offer a solution. |
[2020-10-19 22:44:33] |
User923291 - Posts: 27 |
Apologies for not being clear. I have three active alerts, A, B and C which work and appear on the main graph as three different symbols when conditions for each are true. I am now seeking to have a single alert when all three are true for the same bar. How do I create an alert for when A and B and C are all true? I don’t see this listed on the reference page. Thank you.
|
[2020-10-20 00:23:26] |
Sawtooth - Posts: 4173 |
From your example, corrected for syntax: =AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOW(ID1.SG1,ID1.SG2),ID8.SG1>ID8.SG1[-1]) This will color every bar when all 3 conditions are TRUE. This is the basic format to color only the first bar when all 3 of the conditions are TRUE: =OR(AND(A[-1]=0,A=1,B=1,C=1),AND(A=1,B[-1]=0,B=1,C=1),AND(A=1,B=1,C[-1]=0,C=1)) Notice that this has 3 sets of AND, where only one of the conditions in each goes TRUE, and the other two are already TRUE. |
[2020-10-22 15:38:27] |
User923291 - Posts: 27 |
Thank you for your reply. Accordingly, I wrote: =OR(AND(ID2.SG1+ID2.SG2>0,ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>ID2.SG1[-1]+ID2.SG2[-1],ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOWID1.SG1,ID1.SG2,ID8.SG1 > ID8.SG1[-1]) and received a syntax error. Do you see the error in brackets and/or elsewhere in the sequence to be corrected? I am trying to capture a few options for the first variable to provide a true outcome including: X+Y>0, X+Y>X+Y(-1) or X crosses Y. Thank you. |
[2020-10-22 15:41:18] |
User923291 - Posts: 27 |
Apologies as that was not the last iteration I tried. I added brackets to the crossover statement as well but a syntax error remains. Do you have suggestions? =OR(AND(ID2.SG1+ID2.SG2>0,ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>ID2.SG1[-1]+ID2.SG2[-1],ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOW(ID1.SG1,ID1.SG2),ID8.SG1 > ID8.SG1[-1]) |
[2020-10-22 15:42:13] |
Sawtooth - Posts: 4173 |
Close the OR with another parenthesis at the end of the formula.
|
[2020-10-22 15:44:47] |
User923291 - Posts: 27 |
Tried version below and the syntax error remains... =OR(AND(ID2.SG1+ID2.SG2>0,ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>ID2.SG1[-1]+ID2.SG2[-1],ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]),AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOW(ID1.SG1,ID1.SG2),ID8.SG1 > ID8.SG1[-1])) |
[2020-10-22 17:10:39] |
User923291 - Posts: 27 |
Any suggestions to correct the syntax would be greatly appreciated.
|
[2020-10-22 22:42:53] |
Sawtooth - Posts: 4173 |
This formula works for me, and does not give a syntax error: =OR( AND(ID2.SG1+ID2.SG2>0,ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]), AND(ID2.SG1+ID2.SG2>ID2.SG1[-1]+ID2.SG2[-1],ID1.SG1>ID1.SG2,ID8.SG1 > ID8.SG1[-1]), AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOW(ID1.SG1,ID1.SG2),ID8.SG1 > ID8.SG1[-1])) This is the same formula from post #11. |
[2020-10-23 19:03:37] |
User923291 - Posts: 27 |
Hello, The ID8 Study refers to user contributed study Slope of MA34(two stage). I believe I have erred in how I reference the subgraphs. I am seeking to add a signal which alerts when it is increasing but see that the ID8.SG1>ID8.SG1[-1] does not consistently produce a signal even when the ID8 study graph is rising. Are you able to comment on this study? Thank you. |
[2020-10-23 20:47:19] |
Sawtooth - Posts: 4173 |
The User Contributed 'Slope of MA34(two stage)' study colors the line based on its settings, but it does not output any values related to those colorings. But you should still be able to compare the current SG1 with SG1[-1] using ID8.SG1 > ID8.SG1[-1]. It works for me when used by itself. I notice that your formula does not follow the ABC format in post #7 regarding ID8. If it is your intent to, try this formula: =OR( AND(ID2.SG1+ID2.SG2>ID2.SG1[-1]+ID2.SG2[-1],ID1.SG1>ID1.SG2,ID8.SG1>ID8.SG1[-1]), AND(ID2.SG1+ID2.SG2>0,CROSSFROMBELOW(ID1.SG1,ID1.SG2),ID8.SG1>ID8.SG1[-1]), AND(ID2.SG1+ID2.SG2>0,ID1.SG1>ID1.SG2,ID8.SG1<ID8.SG1[-1],ID8.SG1>ID8.SG1[-1])) In the 1st AND, the 1st condition transitions, the 2nd and 3rd have already. In the 2nd AND, the 2nd condition transitions, the 1st and 3rd have already. In the 3rd AND, the 3rd condition transitions, the 1st and 2nd have already. |
To post a message in this thread, you need to log in with your Sierra Chart account: