Support Board
Date/Time: Sun, 06 Jul 2025 07:08:37 +0000
coding
View Count: 1470
[2019-03-26 16:00:09] |
markuz - Posts: 90 |
Can you please provide the code for when the line of a subgraph is moving upward or downward so I can program it in color background based on alert condition study upward slope vs downward slope |
[2019-03-26 22:25:42] |
|
The easiest thing to do is to simply test the current bar against the previous bar and see whether it is moving up or down. Therefore, you would end up with something like: ID1.SG1[0] > ID1.SG1[-1] to test if it is sloping up at that point, and reverse the comparison for the other way. Refer to the following for how to reference the bars in alerts: Study/Chart Alerts And Scanning: Referencing Data Other Than on the Last Bar/Column In the Chart Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2019-03-27 13:50:58] |
markuz - Posts: 90 |
Thank you. I am looking for how to do a conditional alert on the Clear Method Swing Line. The slope change worked, but it does not capture the Clear Method Swing Line “flips.” See images… |
[2019-03-27 15:43:16] |
John - SC Support - Posts: 40745 |
What you are seeing is just due to how the Line and the Background are drawn. The line is from the middle of one bar to the next, therefore when it changes in the next bar, it looks like it started at the previous bar, where as all it is doing is connecting the values between the two bars. The Background coloring is just filling in the width of the bar in which the event took place. Really, what you are seeing is correct, as the Background is showing where the bar is on which the event occurred. If you change the Clear Method Swing Line study to Dash, it will become more obvious. An option that is available, although we do not think you need it, is to use the Displacement value of the subgraph for the Color Background Based on Alert Condition study, you could set this to -1 to make the background change show up one bar previously, but it will also show the end of the change one bar previous. You will have to determine what works best for how you view your data. Refer to the following for the Displacement option: Chart Studies: Subgraphs Tab >> Displacement For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: