Support Board
Date/Time: Fri, 07 Feb 2025 17:39:29 +0000
[User Discussion] - Problems with CROSSFROMABOVE/BELOW
View Count: 735
[2021-10-25 21:30:26] |
j4ytr4der_ - Posts: 946 |
Can't for the life of me figure out what I'm missing here. This is being placed as the alert condition for a High/Low for Time Period Extended study. =OR(
CROSSFROMABOVE(C,SG2 + ((SG1-SG2) * 0.10)), CROSSFROMBELOW(C,SG2 - ((SG1-SG2) * 0.10)), CROSSFROMABOVE(C,SG2), CROSSFROMBELOW(C,SG2) ) The bottom two simple crosses work fine. The top 2 that reference the size of the range of this study (SG1 and SG2) do not. I can even strip it back to just a single criteria, and they don't alert at all. What am I missing here? |
[2021-10-25 23:47:38] |
Sawtooth - Posts: 4173 |
I seems the CROSSFROMBELOW/CROSSFROMABOVE functions don't work with anything other than just the subgraph. Try this: =OR(
AND(C[-1] > SG2[-1], C < SG2 + ((SG1-SG2) * 0.10)), AND(C[-1] < SG2[-1], C > SG2 - ((SG1-SG2) * 0.10)), CROSSFROMABOVE(C,SG2), CROSSFROMBELOW(C,SG2) ) |
[2021-10-26 00:55:10] |
j4ytr4der_ - Posts: 946 |
I'm not entirely following. I can't be looking at the close of the previous bar, that won't be useful or meaningful to me. I just need to know when price *right now* crosses above or below the high/low of the initial balance (1st hour range), +/- 10% of that range. This can't be on close, has to be realtime. Is that not possible for some reason? BTW this is on 30 minute bars. Date Time Of Last Edit: 2021-10-26 00:55:52
|
[2021-10-26 01:24:57] |
j4ytr4der_ - Posts: 946 |
Actually looking at this again more closely I think I see what it's doing... just some sort of workaround by adding an additional qualification that will by definition be false, if the other is true. Right? Lemme give it a shot and see what's what. Thanks. Date Time Of Last Edit: 2021-10-26 01:25:17
|
[2021-10-26 01:35:35] |
j4ytr4der_ - Posts: 946 |
OK so that works for the top conditions, but now the simpler ones that worked before, don't. Just C crossing SG2. Which could just be CROSSOVER now that I think of it. But regardless that doesn't work either. No alert, I don't see an obvious reason why when it was working previously.
|
[2021-10-26 13:24:30] |
Sawtooth - Posts: 4173 |
The CROSSFROMBELOW/CROSSFROMABOVE/CROSSOVER functions always compare the current bar to the previous bar(s). https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#CROSSFROMABOVE_Function OK so that works for the top conditions, but now the simpler ones that worked before, don't.
The Close never crosses the SG2 of the High/Low for Time Period Extended study because SG2 is always adjusting to the latest Low value.So I don't know how the simpler ones ever worked either. So it's superfluous to include a crossover of SG2 by the Close. If you want an alert on a condition (that isn't compared to the previous bar) when the Close is inside an envelope band of SG2. try this: =AND( C<SG2 + ((SG1-SG2) * 0.10), C>SG2 - ((SG1-SG2) * 0.10)) To alert, and also view where this occurs, use the Color Bar Based On Alert Condition study, and include the ID# of the High/Low for Time Period Extended study: =AND( C<ID1.SG2 + ((ID1.SG1-ID1.SG2) * 0.10), C>ID1.SG2 - ((ID1.SG1-ID1.SG2) * 0.10)) where the High/Low for Time Period Extended study is ID1. |
[2021-10-26 13:55:53] |
j4ytr4der_ - Posts: 946 |
Thanks that's actually what I've already done and it seems to work but I need to spend more time with it. Didn't realize the CROSS studies *only* compare from bar to bar. Bummer as they seem so perfect for something like this. Appreciate the help.
|
To post a message in this thread, you need to log in with your Sierra Chart account: