1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
88 lines of Pine Script v5 from Strategies/Bollinger_Band_Strategy.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Bollinger Band Strategy enters long positions when the closing price crosses above the lower band and short positions when it crosses below the upper band. Upon entry, the script sets dynamic take-profit, stop-loss, and position-averaging levels based on band width. Once price crosses the middle band, stop losses adjust to lock in risk management. Inputs allow users to adjust Bollinger Band length, standard deviation multiplier, and backtesting date ranges.
Standard Bollinger Band indicator calculation
Dynamic take-profit, stop-loss, and scale-in levels
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Strategy Start Date
time
timestamp("20 Jul 2020 00:00 +0300")
start_time
Strategy Exit Date
time
timestamp("20 Jul 2023 00:00 +0300")
exit_time
bb_length
int
20
bb_length
bb_mult
int
2
bb_mult
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit
The Mean Reversion Strategy Template calculates a baseline mean using SMA, EMA, or VWAP alongside upper and lower deviation bands based on standard deviation, ATR, or percentage offsets. It generates long and short entries when price touches, bounces from, or
This strategy backtests a long Bollinger Band deal on the price chart for 3Commas-style bots. It plots short and long simple moving averages, offset bands, and the average entry price of the open deal. A long starts when price crosses the lower band inside a c
This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po
This strategy combines Bollinger Bands with a short RSI to fade moves that leave the bands and then return. A long requires the prior bar below the lower band and oversold, then a close back inside the band while RSI is between 30 and 50. Shorts mirror that at
This strategy plots Bollinger Bands on the price chart using a simple moving average and a multiple of standard deviation. It places a long stop entry when close crosses above the lower band and a short stop entry when close crosses below the upper band. Pendi