Support Board
Date/Time: Fri, 07 Feb 2025 17:58:12 +0000
[Programming Help] - 2 signals into one
View Count: 744
[2022-03-30 23:03:31] |
User312053 - Posts: 10 |
Hello, I am trying to combine two signals into one to give me a buy signal (ie when ID21 occurs within 4 bars of ID4) Any help would be awesome!
|
[2022-03-31 17:09:15] |
John - SC Support - Posts: 37827 |
You have to use the OR function. It would look like the following: OR(SG21 > SG4[-3], SG21 > SG4[-2] SG21 > SG4[-1], SG21 > SG4) Note that we do not know what kind of comparison you are making between ID21 and ID4, so you will have to work out that part of it, we just used Greater Than for the example. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2022-03-31 18:24:34
|
[2022-03-31 18:20:06] |
User312053 - Posts: 10 |
Thanks for the reply. i got a syntax error for that formula. Both ID4 and ID 21 are color based on alert condition studies. So all i want it to do is give another alert when ID21 occurs less then 4 bars/candles after ID4. Thank you |
[2022-03-31 18:33:15] |
John - SC Support - Posts: 37827 |
First of all, when specifying the Subgraph from a separate study, you have use the format of IDx.SGy where x is the number of the study and y is the number of the Subgraph. We updated our previous formula showing Subgraphs, which would work if the subgraphs were from the same study. In order to do what you are wanting with the Color Bar Based On Alert Condition, you need to ensure that you have the following set: - Use -1 on False: No - Output when Condition True: 1.0 This ensures that you get a 1 for true and 0 for false. You will need to work out the particular formula as we are not fully understanding how you want the comparison of ID4.SG1 and ID21.SG1. But you would have to use something like the following: =OR(AND(ID4.SG1, ID21.SG1[-3]), AND(ID4.SG1, ID21.SG1[-2])) You should be able to work out what you need from the above. For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2022-03-31 18:48:30] |
User312053 - Posts: 10 |
Thanks. still cant get a signal to appear but error is gone. There is no comparison between the two, i am just trying to get a signal when ID4 prints and then within 3 bars of ID4 printing ID 21 prints.
|
[2022-03-31 19:07:05] |
User312053 - Posts: 10 |
the light blue background is ID4 and the green up arrow is ID21, SO just when ID21 (green arrow) prints within 3 bars of ID24(light blue background) https://www.sierrachart.com/image.php?Image=1648753492337.png |
[2022-04-04 08:20:25] |
User312053 - Posts: 10 |
I think I have articulated what I am trying to accomplish properly. As a customer, I would appreciate an answer
|
[2022-04-04 16:31:12] |
Sawtooth - Posts: 4173 |
Using another instance of the Color Bar Based On Alert Condition study, try this: =OR(AND(ID4.SG1[-3], ID21.SG1), AND(ID4.SG1[-2], ID21.SG1), AND(ID4.SG1[-1], ID21.SG1)) |
[2022-04-04 18:47:27] |
User312053 - Posts: 10 |
Tom, that is exactly what i was looking for, thank you !
|
To post a message in this thread, you need to log in with your Sierra Chart account: