Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 09:58:54 +0000



[User Discussion] - Reversal Alert Condition Syntax

View Count: 533

[2023-08-18 20:31:17]
User185631 - Posts: 12
Hi, I am trying to create a CBBOAC for a reversal and wondering if someone can help with the Syntax.

The desired output is an Alert Condition = 1 after 3 bars of a separate CBBOAC and then the condition is no longer valid. I've attached a screenshot as an example.

Here is what I have so far:

=AND(ID25.SG1= 1,ID25.SG1[-1]= 1,ID25.SG1[-2]= 1,ID25.SG1[-3]= 1)
imageReversal.PNG / V - Attached On 2023-08-18 20:29:12 UTC - Size: 2.42 KB - 107 views
[2023-08-18 23:58:44]
Sawtooth - Posts: 4120
Try this:
=AND(ID25.SG1= 0,ID25.SG1[-1]= 1,ID25.SG1[-2]= 1,ID25.SG1[-3]= 1)

Not sure what the ID25 conditions are, but the above should work if it is looking for 3 lower lows before a higher low.
[2023-09-07 18:20:32]
User185631 - Posts: 12
Thanks Sawtooth. As a follow up, I'm trying to combine this with another Color Bar Based Alert.

I'm trying to create an alert that combines the two and I believe I need to use IF instead of AND. See below for reference.

=AND(ID26.SG1= 0, ID26.SG1[-1]= 1, ID26.SG1[-2]=1, ID50.SG1 = 1)

IF ID50.SG1 = 1, and then the reversal happens, I want to generate a signal.

Any help is appreciated.
[2023-09-07 20:39:43]
Sawtooth - Posts: 4120
If the reversal is concurrent with the AND formula, then your AND formula will work.

If the reversal happens some bars later, you'll need to make the AND formula persistent, like this:
=IF(AND(ID26.SG1= 0, ID26.SG1[-1]= 1, ID26.SG1[-2]=1, ID50.SG1 = 1),1,IF(releasecondition,0,P4))
where this formula is in P3.

Here are some examples of persistent variables:
Spreadsheet Example Formulas and Usage: Persistent and Incrementing Variables
[2023-09-07 21:18:13]
User185631 - Posts: 12
Thank you

I am not currently using the spreadsheet study for trading, just trying to clean up my signals on the chart.

I've included a screenshot for reference.

The grey shaded area is the initial condition (ID50.SG1=1). The red bar is the reversal bar and entry trigger(AND(ID26.SG1= 0, ID26.SG1[-1]= 1, ID26.SG1[-2]=1).

I'd like to get it to where I can remove the grey shading and only see the entry trigger when both studies are valid.

Appreciate all of your help!
imageEntrySignal.PNG / V - Attached On 2023-09-07 21:17:15 UTC - Size: 18.09 KB - 78 views
[2023-09-07 22:09:24]
Sawtooth - Posts: 4120
I'm sorry, forgot to mention that you'd have to convert the spreadsheet syntax to Alert syntax for use in the Spreadsheet Formula study, where you can use that study to create a persistent variable.

It looks like you don't need a persistent TRUE after all.

It seems this should work. Tell me what this gives you:
=AND(ID26.SG1= 0, ID26.SG1[-1]= 1, ID26.SG1[-2]=1, ID50.SG1 = 1)
[2023-09-07 23:31:42]
User185631 - Posts: 12
I still can't get them both to work as one Alert. But they work when I try them separately.

Attached another example. There should be a signal on the bar with the arrow but it's still not showing.

I may just try and leave them separate and then make another alert where both = 1.
imageExample.PNG / V - Attached On 2023-09-07 23:31:28 UTC - Size: 21.45 KB - 88 views

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

Login

Login Page - Create Account