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);