Login Page - Create Account

Support Board


Date/Time: Mon, 29 Apr 2024 08:37:06 +0000



[User Discussion] - Including slope of a line in calc

View Count: 1413

[2015-01-12 17:29:57]
User20214 - Posts: 24
Hi everyone,
Is there a way to incorporate the formula for a slope (rise over run) into a Sierra equation? I have the following equation which gives me a signal when price turns after three consecutive bars of the same direction, up or down:

=OR(AND(SG3[0]>SG3[-1],SG3[-1]<=SG3[-2],SG3[-2]<=SG3[-3]),AND(SG1[0]<SG1[-1],SG1[-1]>=SG1[-2],SG1[-2]>=SG1[-3]))

This is working fine, but it generates signals also when prices go sideways. I would prefer a signal generated when prices were moving up/down on a 45 degree or greater. So I’m looking to incorporate the slope of a steep line (or ema) into the filter.

Is it even possible to do so with Sierra Charts? I can’t find any thread in the forum on this topic. Perhaps it is too simplistic.
Any ideas?
Thanks in advance.

[2015-01-12 22:40:05]
Sawtooth - Posts: 3982
Since the x and y axis scaling affects a visual angle, you'd first need to determine what value differentiation of the line creates a 45 degree angle, then include it in the formula:
AND(SG3[0]>SG3[-1],SG3[-1]<=SG3[-2],SG3[-2]<=SG3[-3],SG3[0]-SG3[-3]>TICKSIZE*2)
or
AND(SG3[0]>SG3[-1],SG3[-1]<=SG3[-2],SG3[-2]<=SG3[-3],SG3[0]-SG3[-3]>0.5)
[2015-01-12 23:45:02]
User20214 - Posts: 24
Thanks tomgilb,
Will give it a whirl on both the ticksize diff and the numerical diff. Appreciate the help.

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

Login

Login Page - Create Account