Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 21:28:58 +0000



[Programming Help] - Conditional study language

View Count: 652

[2018-05-20 19:22:01]
User28682 - Posts: 233
Hi, I would like to produce an alert when:

1) High[-1]<=H[-2]and Low[-1]>=L[-2]
2) C>H[-1] OR C<L[-1]

So assuming the inside bar is TRUE (1), I want it to trigger if the current bar takes out either the previous
bars(inside bar) high or low (2).

I did this without success:

=AND(H[-1]<=H[-2],L[-1]>=L[-2]),OR(C>H[-1],C<L[-1]))

I tried this and did not get an error message but so far no triggers with a TRUE:

=OR(AND(H[-1]<=H[-2],L[-1]>=L[-2]),AND(C>H[-1],C<L[-1]))

I need the second part of the formula to be an "OR", meaning one or the other will most likely trigger.

Help!

Thanks!
Date Time Of Last Edit: 2018-05-21 02:07:13
[2018-05-21 14:10:28]
@sstfrederik - Posts: 403
try this:
=AND((H[-1]<=H[-2],L[-1]>=L[-2]),OR(C>H[-1],C<L[-1]))
[2018-05-21 14:24:42]
User28682 - Posts: 233
"try this:
=AND((H[-1]<=H[-2],L[-1]>=L[-2]),OR(C>H[-1],C<L[-1]))"

I got this error message when I tried that:

Alert Formula Error - Chart: MU 5 Min #29 | Study: IT | Error: #SYNTAX! | Formula: =AND((H[-1]<=H[-2],L[-1]>=L[-2]),OR(C>H[-1],C<L[-1])) | No alert sound/email.
[2018-05-21 15:02:37]
@sstfrederik - Posts: 403
Sorry. This one should work:

=AND(AND(H[-1]<=H[-2],L[-1]>=L[-2]),OR(C>H[-1],C<L[-1]))
Date Time Of Last Edit: 2018-05-21 16:02:14

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

Login

Login Page - Create Account