Support Board
Date/Time: Sun, 24 Nov 2024 14:40:57 +0000
Post From: REQUEST -- Including Slope Data from Indicators
[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. |