This is not a "volatility squeeze". Volatility is a completely separate measure of historical price than what you are requesting.
https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/G-L/HistoricalVolatility.html
I've stated this in your previous post but got no response so I deleted your post. What you are describing here is called "price contraction". There are many technical tools which measure this. You can simply work with the existing tools and adjust the settings until you reach the desired result. There is really no reason to write up a custom code to solve this. However....
For your particular case you could do something like this:
input numberOfDays = 15;
def upperBand = Highest(high, numberOfDays);
def lowerBand = Lowest(low, numberOfDays);
plot priceContraction = (upperBand - lowerBand) / close <= 0.015;
Change these two lines:
def upperBand = Highest(high, numberOfDays);def lowerBand = Lowest(low, numberOfDays);
To this:
def upperBand = Highest(close, numberOfDays);
def lowerBand = Lowest(close, numberOfDays);