Support Board
Date/Time: Tue, 26 Nov 2024 09:39:05 +0000
Post From: problem signal study based on slope
[2023-12-28 15:31:43] |
Sawtooth - Posts: 4120 |
That formula does not account for slope changes after more than 2 previous segments of the same level. You must use a formula that makes slope changes persistent, then find the transitions. Add the Spreadsheet Formula study, and use a formula like this in its Formula field: =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. This will return a 1 when the slope is upward colored, and a -1 when the slope is downward colored. This formula is converted from spreadsheet syntax to Alert syntax from this example: Spreadsheet Example Formulas and Usage: Formula that Matches the Slope Coloring of a Study Subgraph Line Now use the Color Bar Based On Alert Condition study to find the transitions, like this: =ID2.SG1[-1]<>ID2.SG1 If you want separate upslope signals and downslope signals, use 2 instances of the color bar study with formula like these: =ID2.SG1[-1]>ID2.SG1 =ID2.SG1[-1]<ID2.SG1 |