saolof

Least Squares Bollinger Bands

Similar to Bollinger Bands but adjusted for momentum. Instead of having the centerline be a simply moving average and the bands showing the rolling variance, this does a linear regression , and shows the LSMA at the center, while the band width is the average deviation from the regression line instead of from the SMA .

This means that unlike for normal Bollinger bands , momentum does not make the bands wider, and that the bands tend to be much better centered around the price action with band walks being more reliable indicators of undersold/oversold conditions. They also give a much narrower estimate of current volatility /price range.
Release Notes: Cleaned up some code to make it more general. Now easy to modify with whatever moving average you like if you want to vary the weights on the linear regression. Also added a toggle to disable working with logged values.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?