Login Page - Create Account

Support Board


Date/Time: Sun, 09 Aug 2020 06:02:04 +0000



[Programming Help] - based on slope

[2020-07-01 01:48:14]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Is there a way yet to formulate alerts to fire based on slope? If you don't use slope I know that you can simply say AND(ID15.SG1>ID15.SG1[-1] for example. This works fine for a line moving up or down, but doesn't necessarily work with slope. How can you program slope in if it turns green or red?

Thanks
[2020-07-01 02:18:06]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
https://www.sierrachart.com/index.php?page=doc/StudyChartAlertsAndScanning.php#FormulaExamples
Go to example 8 or 9.
[2020-07-01 13:00:17]
Chadly - Posts: 41 | Ending Date: 2021-03-15
This doesn't quite work. You'll have at times it showing true for slope down and up. That's not possible, it either is up or down not both. I can't quite figure why it would be true on both with this code at times.

I should also warn that this is not a single line. I can get it to work like this code for MA for example, but not for RSi/SMI etc.
Date Time Of Last Edit: 2020-07-01 13:01:28
[2020-07-01 13:24:10]
JohnR - User831573 - Posts: 64 | Ending Date: 2021-04-20
I haven't tested it, but I would guess it is when the slope is 0. Or it could be some other internal comparison logic they are using.

JohnR
[2020-07-01 13:30:36]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
I should also warn that this is not a single line
This is a critical piece of information that you initially didn't share.

Please share specifically your conditions for the alert.
[2020-07-03 15:54:56]
Chadly - Posts: 41 | Ending Date: 2021-03-15
The condition would need to be as follows. I'll preface this slightly with the slope capability that SC has. As you know, RSI, SMI, all those multiple line indicators can be set to slope and different colors when slope. What I would like to do, is have the alert identify when both lines are sloped up or conversely for down.

As of now, to the human eye, I can see slope as red for down and slope as green for up. I would like to have an alert so that when sloped up, it alerts and when sloped down it alerts. (both lines) - So the false would be produced when one line is sloped down and one line is sloped up. You would not get a signal. Both lines would need to be sloped up for example. Both lines conversely would need to be sloped down. If one line deviates, the signal does not fire.

this code provided is extremely close, however there are sometimes when one line is obviously (not flat at all) sloped in the opposite direction and the other line sg2 for example is sloped up. It actually produced a signal in both directions.
[2020-07-03 17:44:55]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
You need to combine the formulas that reference each line with the AND( function, and add a condition when the other line is already sloped.
=AND(
OR(AND(SG1[0] > SG1[-1],SG1[-1] < SG1[-2],SG2[0]>SG2[-1]), AND(SG1[0] < SG1[-1],SG1[-1] > SG1[-2],SG2[0]<SG2[-1])),
OR(AND(SG2[0] > SG2[-1],SG2[-1] < SG2[-2],SG1[0]>SG1[-1]), AND(SG2[0] < SG2[-1],SG2[-1] > SG2[-2],SG1[0]<SG2[-1])))
-where SG1 is one line, and SG2 is the other line.
-you may want to separate upslope and downslope alerts to keep is simple.
-if both lines are not is the same study, you'll need to include their respective ID#s.
-this formula uses the Example #8 formula.

Example #8 will not find any flat segments, example #9 will only find one flat segment. If there are more than one sequential flat segments, you'll need to use a modification of this formula in the Formula field of the Spreadsheet Formula study:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetExampleFormulasAndUsage.php#FormulaThatMatchesTheSlopeColoringOfAStudySubgraphLine
If you want to pursue this more accurate solution, post again and I'll share the many details.
Date Time Of Last Edit: 2020-07-04 03:59:39
[2020-07-04 01:24:29]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Yes, I'd love details. As I have it right now, I use only a normal line (not measuring slope, set to none in settings.) It then measures + or - differences only. As you can imagine, plus or minus differences are not necessarily slope. It's quite interesting really. The human eye automatically see's and will consider slope immediately whereas the computer, you must program it to read slope and not just plus or minus difference current from last for example.

Basically, the human is seeing slope and I have even been able to color code my charts so that it is quite easy for even a novice to glance at my charts and determine a position. This color sequencing obviously uses slope not just plus or minus differences. This color and slope aspect is much more accurate than just a plus or minus difference that you'd put in perhaps a regular alert for example.

Essentially, I believe that most false positive alerts that people experience are because of this difference (slope vs plus or minus.) The computer is doing what it's told and measuring to the decimal a change from previous to next(current) plus or minus decimal value. It then creates the True for the rest of your recipe which may not actually be what you're wanting see?

I greatly appreciate your help. I crave this kind of thing so, it's quite interesting to meet someone with the same likeness.

I'll go back once again and test this code out you posted above. Perhaps I was using example 9 instead.
[2020-07-04 04:08:40]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
Please share the ID#.SG# of each of the two lines.
[2020-07-04 15:18:51]
Chadly - Posts: 41 | Ending Date: 2021-03-15
ID.15 SG1 AND ID.15 SG2

please do keep in mind that usually I'll have a few other things in the recipe as well. So, for example I'd have the above slope, and above MA and, cross, and... overlay true, and..

I may be able to simply segment this though and built a slope for all lines, but the reality is I take 3 indicators, my human eyes see the slope on all three, then that's some of the recipe see?

So, for example right now not using slope, I use plus or minus difference. If SMI and RSI are plus on sg1 and sg2 both lines, then slow sto is also and candle is above EMA, then fire the alert. so you can see there are quite a few things in this as well.

If I segment, what I'd do is simply use your slope code for each indicator, then just add the overlay factor into the actual alert. So I would just use a "true" factor overlay for each indicator if slope is up or down type thing. That could work. This also may be the only way to do it as there are character limits anyway.
[2020-07-04 15:46:19]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
Since you have so many other things going on, I'll just give you the slope formula for one of the lines, and you can go from there.

Add the Spreadsheet Formula study, put this in the Formula field:
=IF(OR(ID15.SG1>ID15.SG1[-1],AND(ID15.SG1[-2]>=ID15.SG1[-1],ID15.SG1>ID15.SG1[-1])),1,IF(OR(ID15.SG1<ID15.SG1[-1],AND(ID15.SG1[-2]<=ID15.SG1[-1],ID15.SG1<ID15.SG1[-1])),-1,ID16.SG1[-1]))
- where ID16 is the Spreadsheet Formula study.

Up slopes will be 1 and downslopes will be -1.
[2020-07-07 13:46:38]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Thank you, I'll give it a shot.
[2020-07-07 15:38:55]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Just to be clear... Is this code for a down slope? Then I just replace all of the -1 with 1 correct for up slope?

Thanks again for your help. I'm convinced this is the issue with automation. Manually my trading is fantastic, but my eyes are seeing slope. Automation is currently seeing a change in plus or minus which isn't always slope as explained earlier so slope is a huge deal I believe.
[2020-07-07 16:42:09]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
Is this code for a down slope?
The formula returns both up and down slopes.
Up slopes will be 1 and down slopes will be -1.
I just replace all of the -1 with 1 correct for up slope?
You don't replace anything in the formula. You reference its output.

The formula tells you the slope of the line.
[2020-07-08 12:55:55]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Alright, I had a chance to play with this a little. I'm not incredibly familiar with the spreadsheet study, but I don't think ultimately this would get me where I need t o be either way unless I'm programming to the ASCIL or whatever.

Is there a way to get the same result with just a normal "change color bar" study? Except that when it slopes up, I can have it turn green, if it slopes down I can have it turn red. Or.... Based on study I can have a red triangle when sloped down, green triangle when sloped up?

This would make it so that I can alert it respectfully.

I'm fully aware that most lines in SC has a slope capability in the settings. This option to my knowledge cannot be alerted as it is "true" for any movement, not just up or down. Therefore, it fires a signal if the line moves in a slope in down or up, not just one or the other.

The idea being that I would obviously put the slope up aspect within other up factors for an entire recipe of up/buy.
[2020-07-08 15:01:13]
tomgilb - Posts: 2635 | Ending Date: 2020-12-03
You don't need to use ACSIL for this.

lines in SC has a slope capability in the settings. This option to my knowledge cannot be alerted
The instructions in post #11 will identify this slope coloring, and therefore it can be alerted.

please do keep in mind that usually I'll have a few other things in the recipe as well.
If you'd like me to put this all together for you, contact me here:
https://www.sawtoothtrade.com/contact.html
Date Time Of Last Edit: 2020-07-08 18:26:32
[2020-07-08 21:01:06]
Chadly - Posts: 41 | Ending Date: 2021-03-15
I'll reach out shortly. thank you!
[2020-07-11 03:33:47]
Chadly - Posts: 41 | Ending Date: 2021-03-15
Alright, anyone else have a solution? Apparently it's not possible. Everyone that has tried has not been able to unless ACSIL.

Is there a simple alert option?

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

Login

Login Page - Create Account