Support Board
Date/Time: Sun, 24 Nov 2024 14:23:56 +0000
[User Discussion] - REQUEST -- Including Slope Data from Indicators
View Count: 906
[2015-07-12 19:32:40] |
djcurcio - Posts: 236 |
The slope of an indicator is a very useful bit of data, but it must be calculated by complicated user code. Yet, the slope is obviously calculated as part of the indicators as the Auto-Coloring Parameter indicates choices based on Slope. Therefor, the slope is already known to the indicator. REQUEST" Slope data should be available as an output, visible in the Display Subgraph Values and as a data column in the Spreadsheet. Thanks |
[2024-06-04 23:30:13] |
jsandlan - Posts: 46 |
That would be very helpful. I'm looking for a good solution to alert when the slope of an indicator is moving up or down.
|
[2024-06-05 14:13:40] |
Sawtooth - Posts: 4118 |
The slope of an indicator is a very useful bit of data, but it must be calculated by complicated user code.
It's not that complicated, especially since it's already been created.For a spreadsheet study, use this example: Spreadsheet Example Formulas and Usage: Formula that Matches the Slope Coloring of a Study Subgraph Line To get an alert when the slope color changes direction, use another Formula Column to find the transitions from 1 to -1 and vise versa. To convert this to Alert syntax for use in the Spreadsheet Formula study: =IF(OR(ID1.SG1[0]>ID1.SG1[-1],AND(ID1.SG1[-2]>=ID1.SG1[-1],ID1.SG1[0]>ID1.SG1[-1])),1,IF(OR(ID1.SG1[0]<ID1.SG1[-1],AND(ID1.SG1[-2]<=ID1.SG1[-1],ID1.SG1[0]<ID1.SG1[-1])),-1,ID2.SG1[-1])) where ID1 is the sloped line, and ID2 is this Spreadsheet Formula study. To get an alert when the slope color changes direction, use the Color Bar Based On Alert Condition study to find the transitions from 1 to -1 and vise versa. |
[2024-06-05 16:18:15] |
jsandlan - Posts: 46 |
Thanks so much! What does this ",1," do in between the two IF(OR) statements? Date Time Of Last Edit: 2024-06-05 16:18:25
|
[2024-06-05 18:55:50] |
Sawtooth - Posts: 4118 |
This formula creates a persistent value of either 1 or -1 A '1' is an upsloped line, and a '-1' is a downsloped line. The first IF statement returns a 1, and the second IF statement returns a -1. It is made persistent by referencing its previous value, until the slope changes direction: - if a spreadsheet syntax formula, by referencing the previous row (row 4) of its Formula Column. - if an alert syntax, by referencing the previous value ([-1]) of the Spreadsheet Formula study. |
To post a message in this thread, you need to log in with your Sierra Chart account: