ATR within 3%


Category:
0
0

Hey Pete, I need help with the final criteria for a scan I built: I want to scan for stocks that are within 3% of the previous day’s ATR. I rummaged through a bunch of your other posts but couldn’t seem to put one together. Thanks!

Marked as spam
Posted by (Questions: 3, Answers: 1)
Asked on June 28, 2021 9:09 pm
61 views
0
Private answer

The following code will find stocks where the current bar's value of the ATR study are within 3 percent of the previous bar's value of the ATR study. Inputs have been added for the percent threshold, atr length and the type of moving average applied to the ATR:

input percentThreshold = 3.0;
input atrLength = 14;
input atrAverageType = AverageType.WILDERS;
def atrValue = ATR(atrLength, atrAverageType);
def lowerThreshold = atrValue * (1 - percentThreshold * 0.01);
def upperThreshold = atrValue * (1 + percentThreshold * 0.01);
plot scan = atrValue > lowerThreshold[1] and atrValue < upperThreshold[1];

Marked as spam
Posted by (Questions: 39, Answers: 3713)
Answered on June 29, 2021 7:24 am
Thank you kind sir!
( at June 29, 2021 7:37 pm)