ATR less than a certain % of the close


Category:
0
0

Hello Pete,

I am trying to write a small code to add to my existing scan that will only find stocks that have a daily ATR smaller than 2 % of the closing price.

I appreciate your help

 

Marked as spam
Posted by (Questions: 6, Answers: 8)
Asked on February 12, 2018 8:13 am
150 views
0
Private answer

What you have stated here is: Take the average of the high minus the low and signal when that value is 2% or less than the close.

input length = 14;
input averageType = AverageType.WILDERS;
def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
plot scan = ATR / close < 0.02;

Attached screenshot shows the value (ATR / Close) plotted on a lower study. The range on the right hand side is in thousandths. So a value of 20 is actually 0.02 (2%).

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 12, 2018 8:59 am
0
Peter, I think he wants a scanner not a chart. I’m looking for the same function but mine is the opposite. I’m looking for high volatile stock where he’s looking for low volatile stock. I want to scan for stocks where the ATR * 80% <= opening_price - Current_price Example: AMZN gain 100 points, ATR = 75; (.8 * 75 = 60) <= ( 100 ) Scan Logic: (.8 * ATR) <= (current stock price movement from open) This should return a List all stocks where value is 0 or 1 if condition above is met or % of stock movement, IE 80%, 81%, 85% etc % over the ATR Thanks.
( at November 9, 2018 3:45 pm)
0

Yes, and that code serves as a scanner. The Chart was made with a variation of the code to display the output so everyone understands how to set the value. In this case the viewer has requested a value of 2%. The screenshot shows the actual value used by the scan requires you to enter a value of 0.02.

Since your request varies so much from the original focus of this post I feel it is best if you create your own post so we can provide a solution that will not muddy the context of this one.

Thanks!

( at November 9, 2018 7:35 pm)