♥ 0 |
Pete, I want to create a scan for just a standard Bollinger Bands Squeeze. Where I get stuck is that TOS lets me reference the BandWidth I can’t figure out how to see if today’s Bandwidth is the lowest range in past x number of days. In a perfect world I would be able to scan for past 20 days, past 6 months etc. This would allow me to pull up the choicest stocks for a volatility breakout. Thank you for all your work on this website. I am learning things from it daily and it has become such a resource for me. You’re a rockstar.
Marked as spam
|
Please log in to post questions.
I think it’s working. I had tried the condition wizard too and got lost quickly. I did save a custom scan, but this code I pasted into “custom” and there was no option to name it. So It;s my Bollinger Band Squeeze scan but the study filter is entitled “custom.” I don’t know if this will cause me problems further out. I did create a study and modified your code to put it in the lower window and added a lookback range function. 10 is giving me wide bands but they are starting to narrow so it bears watching. This all helps a lot Pete. thank you. Awesome site and very very helpful.
declare lower;
input averageType = AverageType.Simple;
input price = close;
input displace = 0;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_Up = 2.0;
input lookbackrange = 50;
def upperBand = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_Up, averageType).UpperBand;
def lowerBand = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_Up, averageType).LowerBand;
def midLine = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_Up, averageType).MidLine;
def Bandwidth = (upperBand – lowerBand) / midLine * 100;
plot scan = Bandwidth < Lowest(Bandwidth[1], lookbackrange);