
This strategy is a mean reversion trading system based on Bollinger Bands, optimized with trend filters and dynamic stop-loss mechanisms. It applies statistical principles to trade price deviations from the mean while using technical indicators to improve win rates and manage risks.
The strategy is built on several key components: 1. Uses 20-period Bollinger Bands as the primary signal source with 2 standard deviation bandwidth 2. Incorporates 50-period EMA as a trend filter to ensure trade direction aligns with medium-term trends 3. Employs 14-period ATR for dynamic stop-loss and profit targets to improve risk-reward ratios 4. Enters long when price touches lower band and is above EMA, shorts when price touches upper band and is below EMA 5. Sets profit target at 2x ATR and stop-loss at 1x ATR
This strategy combines classical technical analysis with modern quantitative methods. Through multiple indicator confirmations and strict risk control, the strategy demonstrates good practicality. Thorough backtesting and demo trading are recommended before live implementation.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Optimized Bollinger Mean Reversion", overlay=true)
// Bollinger Band Settings
length = input.int(20, title="BB Length")
src = input(close, title="Source")
mult = input.float(2.0, title="BB Multiplier")
// Bollinger Bands Calculation
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper = basis + dev
lower = basis - dev
// Plot the Bollinger Bands
plot(basis, color=color.blue)
p1 = plot(upper, color=color.red)
p2 = plot(lower, color=color.red)
fill(p1, p2, color=color.rgb(41, 98, 255, 90))
// Trend Filter - 50 EMA
ema_filter = ta.ema(close, 50)
// ATR for Dynamic Stop Loss/Take Profit
atr_value = ta.atr(14)
// Buy condition - price touches lower band and above 50 EMA
buy_condition = ta.crossover(close, lower) and close > ema_filter
// Sell condition - price touches upper band and below 50 EMA
sell_condition = ta.crossunder(close, upper) and close < ema_filter
// Strategy Execution
if (buy_condition)
strategy.entry("Buy", strategy.long)
if (sell_condition)
strategy.entry("Sell", strategy.short)
// Exit with dynamic ATR-based stop loss and take profit
strategy.exit("Take Profit/Stop Loss", from_entry="Buy", limit=2*atr_value, stop=1*atr_value)
strategy.exit("Take Profit/Stop Loss", from_entry="Sell", limit=2*atr_value, stop=1*atr_value)