Support Board
Date/Time: Sun, 11 May 2025 04:15:16 +0000
[Programming Help] - color background based on alert condition
View Count: 1374
[2016-05-18 19:49:30] |
Chris H - Posts: 5 |
I would like to write a formula using the color background base on Alert condition (unless there is a better study) When the CCI is crossing (or has just crossed) the +100 line in a downward direction and the Moving linear regression length 4 is crossing (or has just crossed) the Moving linear regression length 9 in a downward direction (20 degrees min. if possible): I would like both MLR to be going in the same direction (downward) with 20 degrees when the alert trigger; an arrow would work if the background is making difficult to figure. Then just the oppose with the CCI crossing the -100 line and the move linear regressions crossed and moving upward. You are welcome to call me or do a remote link if that would help (713-992-5220) ID9.SG1=CCI line ID9.SG3= +100 line ID9.SG4= -100 line ID7.SG1=moving linear regression 9 ID6.SG1=moving linear regression 4 =AND(CROSSFROMABOVE(ID9.SG1,ID9.SG3),CROSSFROMBELOW(ID6.SG1,ID7.SG1)) When the CCI line crosses the +100 downward and LR4 crossed LR9 going down =AND(CROSSFROMBELOW(ID9.SG1,ID9.SG3),CROSSFROMABOVE(ID6.SG1,ID7.SG1)) When the CCI line crosses the -100 upward and LR4 crosses the LR9 going up do I need an "study angle" for direction what number of bars to calculate? |
[2016-05-18 21:05:13] |
Sawtooth - Posts: 4214 |
Try these: =OR(AND(CROSSFROMABOVE(ID9.SG1,ID9.SG3),ID6.SG1>ID7.SG1),AND(ID9.SG1<ID9.SG3,CROSSFROMBELOW(ID6.SG1,ID7.SG1))) =OR(AND(CROSSFROMBELOW(ID9.SG1,ID9.SG4),ID6.SG1<ID7.SG1),AND(ID9.SG1>ID9.SG4,CROSSFROMABOVE(ID6.SG1,ID7.SG1))) These will go TRUE when the CCI crosses the OB/OS lines and the MLRs have already crossed, OR when the CCI has already crossed the OB/OS lines and the MLRs cross. You don't need to use the Study Angle study if you don't care about the degree angle of the line. Date Time Of Last Edit: 2016-05-18 23:17:45
|
[2016-05-19 14:13:17] |
Chris H - Posts: 5 |
I am getting every cross of the moving linear regression 4 & 9, not just a cross after the +100 or -100
|
[2016-05-19 18:28:49] |
Sawtooth - Posts: 4214 |
Those formulas will give an alert at every MLR directional cross if the CCI is inside the OB/OS lines. What specifically do you mean when you say "or has just crossed"? |
[2016-05-19 20:50:23] |
Chris H - Posts: 5 |
The only cross of the MLR directional cross I would like to see is the first time the length 4 crosses the length 9 after the CCI has crosses the +100 downward. Currently I am getting the crosses when the CCI crosses the +100 going upward above +100 AND downward plus every cross between the +100 and the -100 lines of the CCI. I only want the first cross after the CCI crosses the OB/OS line, not all of them;' if this is possible . The CCI has went through the +100 and up to +180 then turned and headed back through the +100 toward the zero line, the first time that the length 4 crossed the length 9 after the CCI has penetrated past the +100 is the cross I am trying to get the alert on and visa-a-versa. Thank you for your help Chris Hageman 713 992 5220 cell |
[2016-05-19 21:53:39] |
Sawtooth - Posts: 4214 |
This is more complex than Simple Alerts can do. It could be done with the Spreadsheet System/Alert study. There would need to be a formula to set a persistent TRUE when the CCI crossed, then release it when the MLRs crossed. Then replicate it for the other direction. It would take at least 4 formula columns. Date Time Of Last Edit: 2016-05-19 21:54:00
|
[2016-05-20 01:53:33] |
Chris H - Posts: 5 |
Thank you for your help, I will try to do a much simpler alert
|
[2016-05-20 03:24:16] |
Sawtooth - Posts: 4214 |
These formulas will eliminate some of the alerts because they require the CCI to be on the OB/OS side of zero: =OR(AND(CROSSFROMABOVE(ID9.SG1,ID9.SG3),ID6.SG1>ID7.SG1),AND(ID9.SG1<ID9.SG3,ID9.SG1>0,CROSSFROMBELOW(ID6.SG1,ID7.SG1))) =OR(AND(CROSSFROMBELOW(ID9.SG1,ID9.SG4),ID6.SG1<ID7.SG1),AND(ID9.SG1>ID9.SG4,ID9.SG1<0,CROSSFROMABOVE(ID6.SG1,ID7.SG1))) See bolded above. You could experiment with using a value other than zero to eliminate more spurious alerts. |
[2016-05-20 11:56:28] |
Chris H - Posts: 5 |
I will try this thank you for the extra effort may you have a blessed day Chris Hageman
|
To post a message in this thread, you need to log in with your Sierra Chart account: