Strategy vault / Trend following
Intelligent Volatility Range Trading Strategy Combining Bollinger Bands and SuperTrend
This is an intelligent trading strategy that combines Bollinger Bands and SuperTrend indicators. The strategy primarily uses Bollinger Bands to identify market volatility ranges while utilizing the SuperTrend…

Strategy Overview
This is an intelligent trading strategy that combines Bollinger Bands and SuperTrend indicators. The strategy primarily uses Bollinger Bands to identify market volatility ranges while utilizing the SuperTrend indicator to confirm market trend direction, enabling trades at high-probability positions. The strategy is designed for various trading instruments and timeframes, performing particularly well on 30-minute and 2-hour timeframes.
Strategy Principles
The core logic of the strategy is based on the following key elements:
- Uses 20-period Bollinger Bands with 2 standard deviations bandwidth, constructing upper, middle, lower bands, and two median lines
- Employs 10-period ATR and factor of 3 to calculate the SuperTrend indicator
- Entry signals:
- Long entry: When price touches the lower Bollinger Band and SuperTrend indicates bullish direction
- Short entry: When price touches the upper Bollinger Band and SuperTrend indicates bearish direction
- Exit signals:
- Long exit: When closing price breaks below the SuperTrend line and trend turns bearish
- Short exit: When closing price breaks above the SuperTrend line and trend turns bullish
Strategy Advantages
- Dual confirmation mechanism increases trade reliability: Combining Bollinger Bands' volatility range and SuperTrend's direction judgment effectively reduces false breakout risks
- Adaptive to market volatility: Bollinger Bands automatically adjust bandwidth based on market volatility, providing good adaptability
- Clear trading signals: Entry and exit conditions are explicit, easy to execute and backtest
- Flexible parameter settings: Can adjust Bollinger Bands length, bandwidth multiplier, and SuperTrend parameters based on different market conditions
- Excellent visualization: Uses different colors and shapes to mark trading signals, convenient for analysis and monitoring
Strategy Risks
- Choppy market risk: May generate frequent false signals in sideways markets
- Lag risk: Both Bollinger Bands and SuperTrend are lagging indicators, may miss optimal entry points in fast-moving markets
- Parameter sensitivity: Different parameter settings may lead to significant performance variations Recommended risk controls:
- Set stop-loss positions to control single-trade risk
- Consider pausing trading during extreme volatility periods
- Regularly optimize parameters to adapt to market changes
Strategy Optimization Directions
- Add market volatility filtering:
- Adjust position sizes in high volatility environments
- Add ATR filter to avoid trading during excessive volatility
- Improve profit-taking and stop-loss mechanisms:
- Dynamically set stop-loss positions based on Bollinger Band width
- Design dynamic profit-taking strategy based on SuperTrend slope
- Add time filtering:
- Avoid important data release times
- Set different parameters for different time periods
- Optimize signal confirmation mechanism:
- Add volume confirmation
- Consider adding trend strength indicators
Summary
This is a complete trading system combining classic technical analysis indicators, which can perform well in both trending and volatile markets through the synergy of Bollinger Bands and SuperTrend. The strategy's visualization design and parameter flexibility make it highly practical. Through the suggested optimization directions, the strategy's stability and profitability can be further enhanced. It is recommended to conduct thorough backtesting and parameter optimization before live trading.
Source Pine Script
/*backtest
start: 2024-12-05 00:00:00
end: 2024-12-12 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Band & SuperTrend Strategy (Standard Chart)", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Bollinger Bands Settings
length_bb = input.int(20, title="Bollinger Band Length")
mult_bb = input.float(2.0, title="Bollinger Band Multiplier")
[bb_upper, bb_basis, bb_lower] = ta.bb(close, length_bb, mult_bb)
// Median Bands
bb_median_upper = (bb_upper + bb_basis) / 2
bb_median_lower = (bb_lower + bb_basis) / 2
// SuperTrend Settings
atr_length = input.int(10, title="ATR Length")
factor = input.float(3.0, title="SuperTrend Factor")
// SuperTrend Calculation based on standard chart OHLC data
[supertrend, direction] = ta.supertrend(factor, atr_length)
// Plotting Bollinger Bands
plot(bb_upper, color=color.red, title="Bollinger Upper Band")
plot(bb_median_upper, color=color.orange, title="Bollinger Median Upper Band")
plot(bb_basis, color=color.blue, title="Bollinger Basis")
plot(bb_median_lower, color=color.purple, title="Bollinger Median Lower Band")
plot(bb_lower, color=color.green, title="Bollinger Lower Band")
// Plotting SuperTrend
supertrend_color = direction > 0 ? color.green : color.red
plot(supertrend, color=supertrend_color, style=plot.style_line, title="SuperTrend Line")
// Customizable Signal Shape Inputs
buy_shape = input.string("shape_triangle_up", title="Buy Signal Shape", options=["shape_triangle_up", "shape_circle", "shape_cross", "shape_diamond", "shape_flag"])
sell_shape = input.string("shape_triangle_down", title="Sell Signal Shape", options=["shape_triangle_down", "shape_circle", "shape_cross", "shape_diamond", "shape_flag"])
// Entry Conditions
buy_condition = ta.crossover(low, bb_lower) and direction > 0
sell_condition = ta.crossunder(high, bb_upper) and direction < 0
// Exit Conditions
exit_buy_condition = ta.crossunder(close, supertrend) and direction < 0
exit_sell_condition = ta.crossover(close, supertrend) and direction > 0
// Strategy Logic
if buy_condition
strategy.entry("Buy", strategy.long)
if sell_condition
strategy.entry("Sell", strategy.short)
if exit_buy_condition
strategy.close("Buy")
if exit_sell_condition
strategy.close("Sell")
// Plot Buy Signal Shape
plotshape(series=buy_condition, title="Buy Signal", location=location.belowbar, color=color.green, style=buy_shape, text="BUY", textcolor=color.white)
// Plot Sell Signal Shape
plotshape(series=sell_condition, title="Sell Signal", location=location.abovebar, color=color.red, style=sell_shape, text="SELL", textcolor=color.white)
Published by ChaoZhang on the FMZ strategy square · last modified 2024-12-13. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Intelligent-Volatility-Range-Trading-Strategy-Combining-Bollinger-Bands-and-SuperTrend.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Multi Timeframe Trend Following StrategyPine Script · Trend following · 1d
- Triple SuperTrend Quantitative Trading StrategyPine Script · Trend following · 1d
- Dual directional Trailing Stop Moving Average Trend StrategyPine Script · Trend following · 1m
- Multi Indicator Golden Swing Trading StrategyPine Script · Trend following · 45m
- Multi Indicator Trend Following Strategy with Bollinger Bands and ATR Dynamic Stop LossPine Script · Trend following · 1d
- Pivot SuperTrend Strategy Across Multiple TimeframesPine Script · Trend following · 1h