Login Page - Create Account

Support Board


Date/Time: Sun, 21 Apr 2024 21:31:17 +0000



[Programming Help] - Refine formula

View Count: 188

[2023-12-01 02:13:05]
User585993 - Posts: 76
I'm creating a formula with the following conditions:

1.- Closed bar higher than the previous and negative delta & closed bar lower than the previous with positive delta


=OR(AND(C > C[1], ID1.SG1 - ID1.SG1[1] < 0), AND(C < C[1], ID1.SG1 - ID1.SG1[1] > 0))


somehow isn't working well, what am I missing?
[2023-12-01 04:48:16]
User719512 - Posts: 227
You'd have to post a chart to know for sure, but the formula seems ok. Technique to debug is use Color Bar Based On Alert Condition. Put a single part of your formula in it. Set the ColorBar SG to Background so it's obvious when it triggers. Repeat for each part of your formula, or duplicate it and use one for each part. Once sorted out, combine with your AND / OR groupings.

I would try:
C > C[1] | obvious...should work
ID1.SG1 - ID1.SG1[1] < 0 | is this working??
etc.
[2023-12-01 18:03:22]
User585993 - Posts: 76
How can I change it to a bar color instead of a closed bar instead? I don't see a subgraph as you can see in the screenshot
attachmentChartbook1.Cht - Attached On 2023-12-01 17:58:02 UTC - Size: 8.68 KB - 192 views
imageScreenshot 2023-12-01 114725.png / V - Attached On 2023-12-01 17:59:53 UTC - Size: 180.83 KB - 32 views
imageScreenshot 2023-12-01 115001.png / V - Attached On 2023-12-01 17:59:58 UTC - Size: 79.56 KB - 29 views
[2023-12-01 18:43:44]
User719512 - Posts: 227
The previous bar is [-1], so you need C > C[-1], or C[0] > C[-1]. For delta, do you want to compare two bars difference, or just the delta in one bar?
here is your chartbook (you will have to Edit | Translate Symbol) on your machine.
Notice the 2 studies I added 12/13 with ID 3/4 with CBBOAC formulas.
From here, you should be able to get going.
imageScreenshot 2023-12-01 103634.png / V - Attached On 2023-12-01 18:41:56 UTC - Size: 407.03 KB - 34 views
attachmentUser585993_Chartbook1.Cht - Attached On 2023-12-01 18:42:09 UTC - Size: 9.35 KB - 46 views

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

Login

Login Page - Create Account