Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 18:02:29 +0000



[Programming Help] - Conditional study alert

View Count: 969

[2018-05-17 13:20:02]
User28682 - Posts: 233
Hi, can SC have a conditional alert?

Ex: C > C[-1] = green OR if C< C[-1] = red

Thanks!
[2018-05-17 14:45:56]
Xfanman1 - Posts: 320
Yes, you can use the OR function in SC.

https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#OR_Function

--
Scott
[2018-05-17 15:50:55]
User28682 - Posts: 233
So it would look something like this?

=OR(C>C[-1],C<C[-1])

I understand that one of those will return TRUE...but can this conditional result then print one of two colors for a bar on the alert?

So if C is > C[-1] the bar would be green, if C < C[-1] the bar would be red

Thanks
Date Time Of Last Edit: 2018-05-17 16:21:18
[2018-05-17 16:03:14]
Xfanman1 - Posts: 320
The easiest thing you could do for this would be to use 2 copies of the Color Bar Based on Alert study and put -->

=C<C[-1] in your Green alert (or whatever color you choose) in the first study

and put -->

=C>C[-1] in your second study and choose the color of the bar for this alert. Together they will get you what you need.

You can string together more conditions using the AND/OR functions but if you want to get much more complicated than that you'll need to move to the Spreadsheet studies or ACSIL. I don't "think" you can identify colors in the Simple Alerts without the use of the Color Bar or Color Background Studies but I am NO expert when it comes to coding alerts. I've become fairly competent with the Simple Alert system but not much beyond that.

--
Scott
Date Time Of Last Edit: 2018-05-17 16:35:08

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

Login

Login Page - Create Account