
Cette stratégie est un système de trading auto-adaptatif combinant les bandes de Bollinger et l’indice relativement faible RSI. La stratégie identifie les opportunités de trading potentielles en utilisant les canaux de prix des bandes de Bollinger et les signaux de survente et de survente du RSI pour capturer les tendances et les fluctuations du marché.
Le cœur de la stratégie est de capturer les opportunités de fluctuation du marché en combinant les indicateurs RSI de la bande de Brin vers le haut, le milieu et le bas. La bande de Brin est basée sur une moyenne mobile de 20 cycles et est calculée en utilisant 2 fois le décalage standard. Le RSI utilise un calcul de 14 cycles et définit 70 comme niveau de survente et 30 comme niveau de survente.
La stratégie a pour avantage de pouvoir s’adapter aux fluctuations du marché et de fournir des signaux de trading fiables, mais il faut toujours tenir compte de l’impact de l’environnement du marché sur la performance de la stratégie. La stabilité et la fiabilité de la stratégie sont susceptibles d’être encore améliorées grâce à l’orientation optimisée de la stratégie.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands and RSI Strategy with Buy/Sell Signals", overlay=true)
// Input settings
bb_length = input.int(20, title="Bollinger Bands Length", minval=1)
bb_mult = input.float(2.0, title="Bollinger Bands Multiplier", minval=0.1)
rsi_length = input.int(14, title="RSI Length", minval=1)
rsi_overbought = input.int(70, title="RSI Overbought Level", minval=50)
rsi_oversold = input.int(30, title="RSI Oversold Level", minval=1)
// Bollinger Bands calculation
basis = ta.sma(close, bb_length)
dev = bb_mult * ta.stdev(close, bb_length)
upper_band = basis + dev
lower_band = basis - dev
// RSI calculation
rsi = ta.rsi(close, rsi_length)
// Buy signal: Price touches lower Bollinger Band and RSI is oversold
buy_signal = ta.crossover(close, lower_band) and rsi < rsi_oversold
// Sell signal: Price touches upper Bollinger Band and RSI is overbought
sell_signal = ta.crossunder(close, upper_band) and rsi > rsi_overbought
// Execute orders
if (buy_signal)
strategy.entry("Buy", strategy.long)
if (sell_signal)
strategy.close("Buy")
// Plotting Bollinger Bands and RSI
plot(upper_band, color=color.red, linewidth=2, title="Upper Band")
plot(lower_band, color=color.green, linewidth=2, title="Lower Band")
plot(basis, color=color.blue, linewidth=1, title="Middle Band")
hline(rsi_overbought, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(rsi_oversold, "Oversold", color=color.green, linestyle=hline.style_dashed)
plot(rsi, "RSI", color=color.orange)
// Add Buy/Sell signals on the chart
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")