Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 17:02:49 +0000



[Programming Help] - Is this a correct Alert Formula for Open Bar 3 times greater than ATR?

View Count: 2175

[2018-09-08 15:16:49]
User164231 - Posts: 278
O>3*SG1

What I need is to create an alert of open candle range expansion, say 3 times more than the last 100 candles.

What have I done wrong? It didn't work.

Thanks in advance.
Date Time Of Last Edit: 2018-09-08 15:24:01
[2018-09-08 15:27:29]
Sawtooth - Posts: 3993
=O>3*SG1
this asks if the Open is greater than 3 times the ATR.

=O*3>SG1
this asks if 3 times the Open is greater than the ATR.
[2018-09-08 16:03:43]
jsoviero - Posts: 84
Hi Tom,

Thank you for your formula help. How do you adjust that formula so that it will only consider the X number of previous bars. For example if you are looking at a one minute bar chart and you are only concerned with the last 100 or less number of bars?
[2018-09-08 16:09:21]
User164231 - Posts: 278
Thanks Tom

Seem like the former formula is correct BUT I could not get it to trigger during chart replay.

I wonder is there any stone left unturned?
[2018-09-08 21:24:49]
Sawtooth - Posts: 3993
Add the Color Bar Based On Alert Condition study, and put the formula in its Alerts tab.
(You must include the ID# of the ATR study; edit as needed):
=O*3>ID1.SG1
This will allow you to see the colored price bars when it is TRUE. (You won't have to use Replay to see if it is working.)

How do you adjust that formula so that it will only consider the X number of previous bars?
The way to do this with a Simple Alert is to use the Color Bar Based On Alert Condition study and set the 'Number of Bars To Calculate' to your requirements.
[2018-09-09 02:24:31]
User164231 - Posts: 278
Hi Tom,

Thanks and it is working now but I need to minimize the amount of signal by triggering only the Open and Previous bar if both are 2* greater than ATR.

I tried this but did not work; O>2*ID2.SG1(2)

Thanks again....
[2018-09-09 03:36:35]
Sawtooth - Posts: 3993
Try this:
=AND(O>2*ID2.SG1,O[-1]>2*ID2.SG1[-1])

Review this documentation for Simple Alert examples and syntax:
Study/Chart Alerts And Scanning: Alert Condition Formula Format
[2018-09-09 05:53:37]
User164231 - Posts: 278
Hi Tom,

Thanks but unfortunately it didn't work. It triggers too many bars that were not fall in the criteria.

I also went through the simple alert. I have since spent some time and try to fine tune your formula but to no avail.
[2018-09-09 13:51:40]
Sawtooth - Posts: 3993
It seems you have additional or different criteria than you've mentioned.

Maybe you could attach a notated screen shot of what you want and don't want.
[2018-09-09 14:20:51]
User164231 - Posts: 278
Hi Tom,

I attach the image.

Thanks again.
imageAlert to trigger after last 2 bars 3 x greater than ATR.jpg / V - Attached On 2018-09-09 14:20:02 UTC - Size: 44.76 KB - 329 views
[2018-09-09 14:57:15]
Sawtooth - Posts: 3993
Try this:
=AND(H-L>2*ID2.SG1,H-L[-1]>2*ID2.SG1[-1])
[2018-09-09 16:14:21]
User164231 - Posts: 278
Hi Tom,

It worked, but in random. This is intriguing! I was using color background with a bar whenever it is true. check out the orange bar.

See attached please.
Date Time Of Last Edit: 2018-09-09 16:15:31
imageRandom.jpg / V - Attached On 2018-09-09 16:13:44 UTC - Size: 42.39 KB - 318 views
[2018-09-09 17:33:35]
Sawtooth - Posts: 3993
Sorry, formula should be:
=AND(H-L>2*ID2.SG1,H[-1]-L[-1]>2*ID2.SG1[-1])

The attached screenshot uses the above formula.
imageOpening ATR.PNG / V - Attached On 2018-09-09 17:33:23 UTC - Size: 42.08 KB - 338 views
[2018-09-09 20:36:50]
User164231 - Posts: 278
Hi Tom,

Working fine now!

You are such a kind soul. May this universe bless you.

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

Login

Login Page - Create Account