OPEN-SOURCE SCRIPT

LAGging span leaves Bollinger Bands strategy

Abstract
This script points out the positions a lagging span leaves a Bollinger Band.
This script does not plot a lagging span but moves the Bollinger Band forward.
You can find profit opportunities by combining this script and risk management.

Introduction
Bollinger Bands is a popular indicator.
It contains a moving average, an upper band and a lower band.
The moving average can indicate trend, the upper band and the lower band can indicate if the price is far away from the moving average.
However, in trading markets, anything can happen.
Both continuation and reversal are possible when the price touches the moving average, the upper band or the lower band.
Therefore, many traders adjust the parameters of the Bollinder Band or add other indicators to improve their trading strategies.
Daveatt et. al. provided an idea that uses a lagging span.
A lagging span is a line chart. It displays the reference price but in earlier time.
For example, if the offset of a lagging span is 26 days, the value of the lagging span on 29 days ago is the reference price 3 days ago.
A lagging span is a part of Ichimoku Cloud.
It can compare the price to the earlier price and the values of indicators in the past.
To compare the price to the values of indicators in the past, we can also shift indicators forward instead of adding a lagging span into the chart.
This script uses shift-the-indicators-forward method.
In other words, this script plots the Bollinger Band forward so that the price can be compared to the values of the Bollinger Band in the past.

Computing and Adjusting
(1) Compute Moving Average
(2) Compute Standard Derivation
(3) Upper Band = Moving Average + Standard Derivation * Multi
(4) Lower Band = Moving Average - Standard Derivation * Multi
(5) Shift the Bollinger Band forward according to the offset parameter.
(6) Mark the points the price leaves the shifted Bollinger Band
(7) Compute the most possible loss and profit before the next opposite signal.

Parameters
source : the data for computing the bollinger band. can be open, high, low, close or their combination.
length : how many days are calculated by the bollinger band
mult : the distance from the moving average to the upper band and the distance from the moving average to the upper band is equal to ( mult * standard derivation ) .
x_offset : the offset of the lagging span

Conclusion
This script can find signals for potential breakout or trend continuation.
If you want to use this signal well, you need to know when to cut loss and protect the profit.

Reference
Daveatt , Bollinger bands/Lagging span cross , BGyrPgOA , Tradingview 2019
How to trade with Bollinger Bands
How to use Ichimoku Cloud
How to trade with a line chart
Bollinger Bands (BB)breakoutbuystopIchimoku Cloudlaggingspanoffset

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer