Bollinger Bands Momentum Trend Following Quantitative Strategy
This strategy is a comprehensive trading system based on Bollinger Bands, RSI indicator, and moving averages. It identifies potential trading opportunities through Bollinger Bands price volatility range, RSI…

Overview
This strategy is a comprehensive trading system based on Bollinger Bands, RSI indicator, and moving averages. It identifies potential trading opportunities through Bollinger Bands price volatility range, RSI overbought/oversold levels, and EMA trend filtering. The system supports both long and short trades and provides multiple exit mechanisms to protect capital.
Strategy Principles
The strategy is based on the following core components:
- Uses Bollinger Bands with 1.8 standard deviation to determine price volatility range
- Employs 7-period RSI for overbought/oversold conditions
- Optional 500-period EMA as trend filter
- Entry conditions:
- Long: RSI below 25 and price breaks below lower Bollinger Band
- Short: RSI above 75 and price breaks above upper Bollinger Band
- Exit methods support either RSI thresholds or Bollinger Band reverse breakouts
- Optional percentage-based stop loss protection
Strategy Advantages
- Multiple technical indicators work together to improve signal reliability
- Flexible parameter settings allow adjustment for different market conditions
- Supports bilateral trading to capture market opportunities fully
- Provides multiple exit mechanisms to suit different trading styles
- Trend filtering effectively reduces false signals
- Stop loss mechanism provides good risk control
Strategy Risks
- May generate frequent false signals in ranging markets
- Multiple indicators might lead to delayed signals
- Fixed RSI thresholds may not be flexible enough for different market environments
- Bollinger Bands parameters need adjustment based on market volatility
- Stop loss settings may be easily triggered during violent fluctuations
Strategy Optimization Directions
- Introduce adaptive Bollinger Bands multiplier based on market volatility
- Add volume indicators for confirmation
- Consider adding time filters to avoid trading during specific periods
- Develop dynamic RSI threshold system
- Integrate more trend confirmation indicators
- Optimize stop loss mechanism, consider using dynamic stop loss
Summary
This is a well-designed quantitative trading strategy that captures market opportunities through multiple technical indicators. The strategy is highly configurable and can adapt to different trading needs. While there are some inherent risks, its stability and reliability can be further enhanced through parameter optimization and additional auxiliary indicators. For investors seeking systematic trading methods, this is a worthwhile strategy framework to consider.
Source Pine Script
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-11 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Scalp Pro", overlay=true)
// Inputs for the strategy
length = input(20, title="Bollinger Band Length")
src = input(close, title="Source")
mult = input(1.8, title="Bollinger Band Multiplier")
rsiLength = input(7, title="RSI Length")
rsiOverbought = input(75, title="RSI Overbought Level")
rsiOversold = input(25, title="RSI Oversold Level")
// Custom RSI exit points
rsiExitLong = input(75, title="RSI Exit for Long (Overbought)")
rsiExitShort = input(25, title="RSI Exit for Short (Oversold)")
// Moving Average Inputs
emaLength = input(500, title="EMA Length")
enableEMAFilter = input.bool(true, title="Enable EMA Filter")
// Exit method: Choose between 'RSI' and 'Bollinger Bands'
exitMethod = input.string("RSI", title="Exit Method", options=["RSI", "Bollinger Bands"])
// Enable/Disable Long and Short trades
enableLong = input.bool(true, title="Enable Long Trades")
enableShort = input.bool(false, title="Enable Short Trades")
// Enable/Disable Stop Loss
enableStopLoss = input.bool(false, title="Enable Stop Loss")
stopLossPercent = input.float(1.0, title="Stop Loss Percentage (%)", minval=0.1) / 100
// Bollinger Bands calculation
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upperBB = basis + dev
lowerBB = basis - dev
// RSI calculation
rsi = ta.rsi(src, rsiLength)
// 200 EMA to filter trades (calculated but only used if enabled)
ema200 = ta.ema(src, emaLength)
// Long condition: RSI below oversold, price closes below the lower Bollinger Band, and optionally price is above the 200 EMA
longCondition = enableLong and (rsi < rsiOversold) and (close < lowerBB) and (not enableEMAFilter or close > ema200)
if (longCondition)
strategy.entry("Long", strategy.long)
// Short condition: RSI above overbought, price closes above the upper Bollinger Band, and optionally price is below the 200 EMA
shortCondition = enableShort and (rsi > rsiOverbought) and (close > upperBB) and (not enableEMAFilter or close < ema200)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Stop Loss setup
if (enableStopLoss)
strategy.exit("Long Exit", "Long", stop = strategy.position_avg_price * (1 - stopLossPercent))
strategy.exit("Short Exit", "Short", stop = strategy.position_avg_price * (1 + stopLossPercent))
// Exit conditions based on the user's choice of exit method
if (exitMethod == "RSI")
// Exit based on RSI
exitLongCondition = rsi >= rsiExitLong
if (exitLongCondition)
strategy.close("Long")
exitShortCondition = rsi <= rsiExitShort
if (exitShortCondition)
strategy.close("Short")
else if (exitMethod == "Bollinger Bands")
// Exit based on Bollinger Bands
exitLongConditionBB = close >= upperBB
if (exitLongConditionBB)
strategy.close("Long")
exitShortConditionBB = close <= lowerBB
if (exitShortConditionBB)
strategy.close("Short")
Published by ChaoZhang on the FMZ strategy square · last modified 2024-11-12. 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/Bollinger-Bands-Momentum-Trend-Following-Quantitative-Strategy.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
- ADX Momentum Trend StrategyPine Script · Momentum · 10m
- Momentum Indicator Aggregation Trading StrategyPine Script · Momentum · 1h
- Multi Indicator Trend Momentum Trading Strategy An Optimized Quantitative Trading System Based on Bollinger Bands Fibonacci and ATRPine Script · Momentum · 1h
- Multi Trend Momentum Crossover Strategy with Volatility Optimization SystemPine Script · Momentum · 1d
- Momentum Oscillation Crossing Bollinger Bands with Moving Average StrategyPine Script · Momentum · 1d
- Momentum Trading Strategy Based on Multi factor ModelPine Script · Momentum · 1d