Scan for ATR less than 50% of it’s six month high


Category:
0
0

Hi Pete,

Hope all is safe and well. I am trying to build a scan that filters stock by the ATR where the current ATR(14) is less than 50% of it’s one six months high. Many thanks for your time and help.

Regards

Ali

Marked as spam
Posted by (Questions: 6, Answers: 10)
Asked on September 10, 2020 6:33 pm
152 views
0
Private answer

I think this will do the job. I haven't tested it.

There are two user inputs. One controls the percent threshold and the other controls the number of bars. The default values assume this code is applied to a Study Filter set to the daily time frame. In the average month there are 21 trading days. This is going to vary based on time of year due to holidays and how many days per month. So we take the average value of 21 trading days per month and multiply that by 6 to arrive at the default value of 126.

input percentThreshold = 50.0;
input withinBars = 126;
input length = 14;
input averageType = AverageType.WILDERS;
def atr = MovingAverage(averageType, TrueRange(high, close, low), length);
plot scan = atr < Highest(atr, withinBars) * (1 - percentThreshold * 0.01);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 10, 2020 7:18 pm
0
Many thanks Pete. It works fine.
( at September 10, 2020 8:54 pm)