Scan for stocks that are 1.5 times ATR


Category:
0
0

Hi Pete,

I looked in the Q&A section but couldn’t find what I’m trying to do.  I’m trying to scan my watchlist of stocks to pull up any stocks when the stock price is 1.5 times their respective ATR or higher.  Just wondering if the below would work.

input length = 14;

input averageType = AverageType.WILDERS;

def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);

plot scan = ATR / close > 0.15;

 

Thank you

RESOLVED
Marked as spam
Posted by (Questions: 7, Answers: 9)
Asked on April 7, 2021 9:17 am
420 views
0
Private answer

I had to update the title of your question because it did not at all match the description in your request. The title of your question requested to scan for stocks that were 2% of ATR. Which works out to the following mathematical formula: close == ATR * 0.02.

This is completely the opposite direction of your stated request. So the question title now matches the description you provided in your question.

There is also a missing component from your request. I must provide this missing component before providing a solution so I will explain what that is. The ATR is a measure of True Range that has been averaged over several bars. The default being 14. So when you say "stock price that is 1.5 time ATR" you are trying to comparing an apple with an orange. The price of a stock can never be compared to value of the ATR directly. Because the current price is a single data point and the ATR is derived from the High, Low and Close. The correct way to compare this is to compare the current bar's True Range to the ATR. That is an apples to apples comparison.

Here is what that looks like in code:

input length = 14;
input averageType = AverageType.WILDERS;
def atr = MovingAverage(averageType, TrueRange(high, close, low), length);
plot scan = TrueRange(high, close, low) >= atr * 1.5;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 7, 2021 11:15 am
0
Thank you Pete
( at April 7, 2021 11:32 am)