Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 11:38:24 +0000



[Programming Help] - Color bar based on alert

View Count: 2054

[2018-10-15 17:20:16]
User739131 - Posts: 27
Hi,


I am trying to write a color bar based on alert condition code that will color the bar when close is a certain number of ticks from the high or low, or price closes either in the upper 25% or lower 25% of the range of the current bar. Any help is greatly appreciated.


Thanks,
MJ
[2018-10-15 18:52:58]
User750920 - Posts: 274
I am new to Sierra Chart but I wanted to do something with the Color Bar on Alert Condition Study and user @sstfrederik helped me out a lot. Based on their help I think I was able to do what you want. So here is the what I did. Add the Study Color Bar based On Alert Condition. You will have to add 2 instances for the study (one for the Close Top 25% and one for Close Bottom 25%.

After you add the study you can in the Settings and Input Change the Short Name so you can recognize which color bar is which. In the Subgraphs Tab set the Draw Style to Color bar and set the color to what you want.
In the Alerts Tab for the Close in the Top 25% write this. =C>=((H-L)*.75+L)
In the Alerts Tab for the Close in the Bottom 25% write this =C<=(H-(H-L)*.75)

It seemed to work for me. Hope it helps and I got it correct.
[2018-10-15 18:58:15]
Sawtooth - Posts: 3976
For closes within 5 ticks from the high or low:
=OR(C>H-TICKSIZE*5,C<L+TICKSIZE*5)

For closes either in the upper 25% or lower 25% of the range of the current bar:
=OR(C>H-(H-L)*0.25,C<L+(H-L)*0.25)

For more information about Simple Alert formulas and syntax:
Study/Chart Alerts And Scanning: Alert Condition Formula Format
[2018-10-15 19:00:56]
User739131 - Posts: 27
Thank you both. Works perfectly.



MJ
[2018-10-15 19:03:52]
User750920 - Posts: 274
Thanks to @tomgilb for the syntax for me to learn more and experiment

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

Login

Login Page - Create Account