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
103 lines of Pine Script v4 from Bollinger -B Candles Strategy.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
Bollinger %B Candles Strategy incorporates customizable moving average filters, ATR multipliers, and optional higher-timeframe yearly high or low trend checks to confirm entry conditions. Traders can select between various moving average types like EMA, SMA, HMA, RMA, VWMA, and WMA, adjust signal delay parameters, and define backtest periods. The strategy executes trades according to the specified direction filter without an explicit stop-loss rule.
Bollinger Bands %B calculation with customizable moving averages
ATR volatility filtering with variable lengths and multipliers
Optional yearly and long-term high and low trend filters
Configurable trade direction and backtest timeframe limits
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
BBLength
int
100
BBLength
useMovingAverage
bool
true
useMovingAverage
Moving Average Type
string
rma
MAType
lookbackPeriod
int
22
lookbackPeriod
colorByPreviousClose
bool
true
colorByPreviousClose
delaySignalBars
int
2
delaySignalBars
Moving Average Type
string
hma
AtrMAType
AtrLength
int
10
AtrLength
AtrMult
int
4
AtrMult
wicks
bool
false
wicks
considerYearlyHighLow
bool
false
considerYearlyHighLow
considerNewLongTermHighLows
bool
false
considerNewLongTermHighLows
Show all 14 settings
Setting
Type
Default
Variable
Trade Direction
input
strategy.direction.all
tradeDirection
backtestYears
int
10
backtestYears
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.
This strategy combines an EMA ribbon with MACD confirmation and plots in a separate pane. It enters when ribbon alignment, optional MACD zero or signal crosses, volume, smart-money, and multi-timeframe filters agree, then exits with percentage stop loss and ta
Sentiment 2 is a trend-following strategy that calculates a normalized composite market sentiment score ranging between 0 and 1. It combines exponential and Hull moving average slopes, high/low midpoints, Supertrend distances, and Parabolic SAR metrics. Plotte
This strategy detects relative performance between Solana and Ethereum using a liquidity-weighted supertrend (LWST) derived from fast and slow weighted moving averages of liquidity times close. It plots the Tsl2 trend line in a separate pane and issues buy sig
This strategy overlays a trend moving average and Supertrend bands directly on the price chart while calculating Stochastic RSI values internally. Long positions trigger when price exceeds the moving average, Supertrend signals bullish momentum, and the StochR
This strategy combines exponential moving averages (EMA 9, 21, 50), RSI, MACD, and Supertrend indicators to enter long positions. It triggers trades using six dynamic setups based on momentum breakouts, EMA crossovers, and pullbacks. Position sizing is compute
CombinedBinHAndClucV6 is a trading strategy based on the popular BinHV45 and ClucMay72018 algorithms. It calculates dual Bollinger Bands, Exponential Moving Averages, Relative Strength Index, Average True Range, and volume metrics across primary and one-hour h