Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 06:54:20 +0000



[Programming Help] - problem signal study based on slope

View Count: 251

[2023-12-14 18:17:41]
User120564 - Posts: 11
Subject updated from 'problem formula SG2' to 'problem signal study based on slope'
--------------------------------------------------------------------------------

I have a problem with the Nasdaq Future: NQ whether with the old version of the software or the current one, with expiry 12/23 or 03/24 in automatic trading: signal study based on slope.
I don't have all the signals for each change in color of the moving average and therefore its slope.
the intraday chart is in aligned renko 10 ticks.
moving average simple skip zero 7 periods last.

signal study based on slope:
settings: id1.sg1
color bar:long signal:sg1 short signal:sg2
alert condition:the sierra chart site formula.

I don't SYSTEMATICALLY have all the color bar signals, sometimes when the slope of the moving average changes I don't have any signals at all.

Thank you for your help in solving this problem.
[2023-12-15 00:02:19]
Sawtooth - Posts: 4120
signal study based on slope
This is not a native study, nor a User Contributed study.

alert condition:the sierra chart site formula.
This is not enough information; what are the alert conditions?
[2023-12-28 12:23:26]
User120564 - Posts: 11
alert condition documentation sierra chart:

Simple Alert Condition Formula for Change of Slope of a Study Subgraph Line: To get an alert when a study Subgraph line changes its slope, then use this Simple Alert Condition Formula: =OR(AND(SG1[0] > SG1[-1],SG1[-1] < SG1[-2]), AND(SG1[0] < SG1[-1],SG1[-1] > SG1[-2])). This formula is meant for study Subgraph 1. This will work fine for any of the Sierra Chart Moving Average studies.

thanks
[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

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account