OPEN-SOURCE SCRIPT

Enhanced Buy/Sell Signals

99
//version=5
indicator("Enhanced Buy/Sell Signals", overlay=true)

// Parameters
lengthRSI = input(14, title="RSI Length")
lengthSMA = input(50, title="SMA Length")
overbought = input(70, title="Overbought Level")
oversold = input(30, title="Oversold Level")
fastLength = input(12, title="MACD Fast Length")
slowLength = input(26, title="MACD Slow Length")
signalSmoothing = input(9, title="MACD Signal Smoothing")

// Indicators
rsi = ta.rsi(close, lengthRSI)
sma = ta.sma(close, lengthSMA)
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)

// Buy/Sell Conditions
buySignal = ta.crossover(rsi, oversold) and close > sma and ta.crossover(macdLine, signalLine)
sellSignal = ta.crossunder(rsi, overbought) and close < sma and ta.crossunder(macdLine, signalLine)

// Plotting
plotshape(series=buySignal, title="Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellSignal, title="Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

// Alerts
alertcondition(buySignal, title="Buy Signal", message="Buy signal detected!")
alertcondition(sellSignal, title="Sell Signal", message="Sell signal detected!")

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.