Daily ATR Range indicator Screener/Alert
Forums › ProRealTime English forum › ProScreener support › Daily ATR Range indicator Screener/Alert
- This topic has 17 replies, 4 voices, and was last updated 5 years ago by robertogozzi.
Tagged: Atr Range
-
-
08/22/2017 at 4:56 PM #44372
Hi there,
I am using the Daily ATR range indicator on my chart as made by Nicolas here; https://www.prorealcode.com/prorealtime-indicators/daily-atr-range-for-intraday-chart/
I am simply looking to be able to set up a screener or alert on my platform when any currency or something in my whatchlist etc breaks above or below the ATR high/Low levels that the indicator draws on my chart.
I have attached a picture of the indicator on my chart, the two orange lines are the indicator. I simply want to be able to screen or be alerted when price goes above or below either of the two lines.
Thanks very much
Dan09/26/2017 at 2:48 PM #4740710/02/2018 at 4:43 PM #8178710/02/2018 at 5:28 PM #81797There you go (screener not tested):
Daily ATR Range123456789101112131415ATRperiod = 20 //change this period as you wishdTR = 0for i = 0 to ATRperioddTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))nextavg = dTR / ATRperiodhtr = Dlow(0) + avg[1]ltr = Dhigh(0) - avg[1]x = 0IF close > htr THENx = 1ELSIF close < ltr THENx = -1ENDIFSCREENER [x] (x AS "Signal")1 user thanked author for this post.
10/04/2018 at 12:10 PM #81901There you go (screener not tested):
Daily ATR Range123456789101112131415ATRperiod = 20 //change this period as you wishdTR = 0for i = 0 to ATRperioddTR=dTR+max(abs(Dhigh(i)–Dlow(i)),max(abs(Dhigh(i)–Dclose(i+1)),abs(Dlow(i)–Dclose(i+1))))nextavg = dTR / ATRperiodhtr = Dlow(0) + avg[1]ltr = Dhigh(0) – avg[1]x = 0IF close > htr THENx= 1ELSIF close < ltr THENx= –1ENDIFSCREENER [x] (x AS “Signal”)
Thank you so much for helping with that, works great!! 🙂Is there a way to get the value to stay 1 or -1 once it’s been touched in the screener? As opposed to only reading 1/-1 for the duration of the time the ATR is breached? If it’s not easy to have that setting, don’t worry!
Thanks again!
10/04/2018 at 2:06 PM #81921Please use QUOTE only when you have to point something important out. Simply write your post in all other cases, otherwise topics will become larger and larger and difficult to read. Thank you.
Yes, we can hold the values for some bars (you will set their number), but this will also increase the list of returned value, which might be an issue when items approach or exceed the 50/100-item limit.
Anyway this is the code (not tested), should you need to restore a shorter life to items scanned just set the LOOKBACK value to 1:
Daily ATR Range1234567891011121314151617181920LookBack = 5 //keep returned items alive for 5 barsATRperiod = 20 //change this period as you wishdTR = 0for i = 0 to ATRperioddTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))nextavg = dTR / ATRperiodhtr = Dlow(0) + avg[1]ltr = Dhigh(0) - avg[1]a = summation[LookBack](close > htr)a = (a > 0) AND (a <= LookBack)b = summation[LookBack](close < htr)b = (b > 0) AND (b <= LookBack)x = 0IF a THENx = 1ELSIF b THENx = -1ENDIFSCREENER [x] (x AS "Signal")should ever both A and B are true, A is returned being the first value to be checked.
10/04/2018 at 5:03 PM #81945Sure, sorry about the quote, good point!
I got a syntax error on that amendment. It says;
“This variable is not used in the code:ltr”
I can’t spot what it relates to. I have tried changing the ATR period but it runs the same parameters as original no matter what value you put in, so maybe that is linked?
Sorry for all questions!
10/04/2018 at 5:15 PM #81946My fault, please replace htr in line 12 with ltr.
Also, should you not get good results with -1 in line 18, replace it with 2 (or whatever digit you prefer), just to keep it different from 1.
10/04/2018 at 5:27 PM #81949ah yes, works perfectly now, thank you.
Do you think there may be a reason that when you change the ATR value for days it makes no difference to the screening results – always brings the same whether = 20 or 100 say
Do you have any idea why that might be?
10/04/2018 at 5:41 PM #81950I duplicated it and modified one of it replacing 20 with 5 and returned items were completely different! I tried with 50 in place of 20 and got no results (on Currencies, 1-hour TF).
10/04/2018 at 6:13 PM #8195110/04/2018 at 6:28 PM #81952It is giving me a lot of 1/-1 signals on contracts that actually haven’t hit their ATR during the day so I don’t know why they show up, but seems to pick all others up as far as I can see so that’s not as issue, just a strange one 🙂
10/05/2018 at 8:07 AM #8197311/14/2019 at 2:48 PM #112804A good idea this alert, but doesn’t seem to work for me. See attachment, display is alerted but the atr lines were never breached
Using this code…
1234567891011121314151617181920LookBack = 5 //keep returned items alive for 5 barsATRperiod = 20 //change this period as you wishdTR = 0for i = 0 to ATRperioddTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))nextavg = dTR / ATRperiodhtr = Dlow(0) + avg[1]ltr = Dhigh(0) – avg[1]a = summation[LookBack](close > htr)a = (a > 0) AND (a <= LookBack)b = summation[LookBack](close < ltr)b = (b > 0) AND (b <= LookBack)x = 0IF a THENx = 1ELSIF b THENx = -1ENDIFSCREENER [x] (x AS “Signal”)11/14/2019 at 3:23 PM #112810>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
🙂 -
AuthorPosts
Find exclusive trading pro-tools on