Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 23:38:01 +0000



[Programming Help] - How to create an COLOR BAR BASED UPON ALERT CONDITION for multiple bars following a signal

View Count: 553

[2023-02-07 18:58:40]
User29194 - Posts: 5
I have an indicator that gives a Long and Short signal. I would like all bars after a long signal to be one color until the Short signal is fired. The bars would then be a different color to indicate a short.

I am using multiple indicators and the above signal may fire before all conditions are met. So I need a way to have that signal be persistent until toggled the other direction.

One option would be that the alert is looking back over a range of bars.

Example
Bar 1 - get a signal but no other confluences
Bar 2 - I get a MA confluence
Bar 3 - I get a RSI confluence At this point I want to trigger a long since Condition 1,2 and 3 are met.


I know how to handle the MA and RSI as they are values that change every bar.

I need to be able to carry that signal bar value forward to several bars. It is not a # value. It is a True or False value and only shows up on the bar that generated that signal.
Date Time Of Last Edit: 2023-02-07 19:43:49
imagesc support.PNG / V - Attached On 2023-02-07 18:57:42 UTC - Size: 30.95 KB - 129 views
imagesc support 2.PNG / V - Attached On 2023-02-07 19:41:28 UTC - Size: 42.75 KB - 114 views
[2023-02-07 22:03:51]
Sawtooth - Posts: 4120
Try this:
=IF(AND(LongCondition1,LongCondition2,LongCondition3),1,IF(AND(ShortCondition1,ShortCondition2,ShortCondition3),-1,ID1.SG1[-1]))
where ID1 is the color bar study.
This will make the confluent signal persistent until the opposite confluent signal.

Then set the Auto-Coloring to Based On +/-
[2023-10-08 07:46:12]
Sudhirc - Posts: 52
i have some thing similar, and appreciate any help.
how do i assign a Condition?
so for me
close below Opening Range low is a short condition1, Now when price touches a simple moving average (5) and close below should trigger a short
Close above opening range high is a long condition2, Now when price touches a simple moving average (5) and close above should trigger a long

Thank you
[2023-10-09 15:10:46]
Sawtooth - Posts: 4120
First make the close outside the Opening Range persistent:
=IF(C>ORhigh,1,IF(C<ORhigh,-1,ID1.SG1[-1]))
where ID1 is this color bar study.

Then use two more instances of the color bar study to combine the persistent with the MA crossover:
Long trigger:
=AND(ID1.SG1=1,CROSSFROMBELOW(C,ID2.SG1))
Short trigger:
=AND(ID1.SG1=-1,CROSSFROMABOVE(C,ID2.SG1))
where ID2 is the MA.

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

Login

Login Page - Create Account