Login Page - Create Account

Support Board


Date/Time: Sat, 15 Nov 2025 13:05:04 +0000



[Programming Help] - Formula Alerts error

View Count: 55

[2025-11-14 18:31:03]
rebeccaemme - Posts: 30
Hello,
I have try to creare a color bar based condition formula for detect the following pattern:

The previous bar has a large delta At least 2000 (negative or positive)

The current bar must be in the opposite direction of the previous bar (bullish after bearish, or bearish after bullish).
And this current bar must break the high (for bullish scenario) or the low (for bearish scenario).

And this current bar must have a low delta opposite to the previus bar. EXAMPLE the previous bar was bearish with a Delta of -2000 and This Currently bur must break his high and has a delta only of +400.
I have tried to create the formula in this way however give me error
(
ABS(AV[-1]-BV[-1])>=2000
AND C[-1]<O[-1]
AND C>O
AND H>H[-1]
AND ABS(AV-BV)<=400
)
OR
(
ABS(AV[-1]-BV[-1])>=2000
AND C[-1]>O[-1]
AND C<O
AND L<L[-1]
AND ABS(AV-BV)<=400
)

Please I hope someone could help me to know where was wrong!
Thank you
[2025-11-14 19:07:37]
User431178 - Posts: 811
Nesting is wrong, should be something like this

>>> OR(AND(cond1, cond2, cond3, etc),AND(cond1, cond2, cond3, etc))

See here - Study/Chart Alerts And Scanning: Alert Formula Examples
Date Time Of Last Edit: 2025-11-14 19:07:48
[2025-11-14 19:26:40]
rebeccaemme - Posts: 30
Because when I wrote this formula I’ve got error but I really don’t understand what’s wrong. I hope the support can reply
[2025-11-14 19:35:48]
User431178 - Posts: 811
Because when I wrote this formula I’ve got error but I really don’t understand what’s wrong. I hope the support can reply

If you look at the linked example you will understand better.
And, like I said, the nesting of your formula is wrong.

Here is corrected version.


=OR(AND(ABS(AV[-1]-BV[-1])>=2000,C[-1]<O[-1],C>O,H>H[-1],ABS(AV-BV)<=400),AND(ABS(AV[-1]-BV[-1])>=2000,C[-1]>O[-1],C<O,L<L[-1],ABS(AV-BV)<=400))

Here are some direct links to understand how to apply AND and OR functions.

https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#AND_Function
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#OR_Function
[2025-11-14 19:56:19]
rebeccaemme - Posts: 30
Thank you so much!
[2025-11-14 20:06:30]
rebeccaemme - Posts: 30
The only things which I have notice now that is not working proper because of this:
I have 1 Bar Bearish with Negative Delta -1800 And then second Bar Bullish which break with delta -400! I would like that It will highlight ONLY if the delta of the second bar is Positive as its the bullish bar & viceversa scenario (example Bar Bullish +1800 and then Bearish bar break is low and MUST HAVE A Negative delta example -400) How can I resolve that? Thank you!

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

Login

Login Page - Create Account