Here's the same script adapted for the TradingView Pine Editor:
//@version=5
study("BTC Buy and Sell Signals", shorttitle="BTC Signals", overlay=true)
// Initialize the Bitcoin/USDT trading pair
var symbol = "BTC/USDT"
// Calculate technical indicators
macd = ta.MACD(close, 12, 26, 9)
rsi = ta.RSI(close, 14)
upper, middle, lower = ta.BBANDS(close, 20, 2, 2, 0)
dc_upper = ta.HHV(high, 20)
dc_lower = ta.LLV(low, 20)
// Generate buy signals
buy_signal_golden_cross = ta.crossover(macd, signal) and ta.above(0)
buy_signal_death_cross = ta.crossover(signal, macd) and ta.below(70) and (close < middle) and (close < lower)
// Generate sell signals
sell_signal_rsi = ta.crossover(rsi, 30)
sell_signal_bbands = ta.crossover(close, middle) and ta.above(upper) and ta.below(lower)
// Combine buy and sell signals
signals = ta.sum(buy_signal_golden_cross + buy_signal_death_cross + sell_signal_rsi + sell_signal_bbands, 1)
// Plot the signals
plot(signals, "Buy/Sell Signals", color=color.white, linewidth=2)
// Output the signals
ta.bar(signal, show_first = 1, title = "Buy/Sell Signals", linewidth = 2)