OPEN-SOURCE SCRIPT

High-Accuracy Buy/Sell Signal

//version=5
indicator("High-Accuracy Buy/Sell Signal", overlay=true)

// Input parameters
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")

macdFastLength = input.int(12, title="MACD Fast Length")
macdSlowLength = input.int(26, title="MACD Slow Length")
macdSignalSmoothing = input.int(9, title="MACD Signal Smoothing")

bbLength = input.int(20, title="Bollinger Bands Length")
bbMultiplier = input.float(2.0, title="Bollinger Bands Multiplier")

// RSI Calculation
rsi = ta.rsi(close, rsiLength)

// MACD Calculation
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalSmoothing)

// Bollinger Bands Calculation
basis = ta.sma(close, bbLength)
dev = bbMultiplier * ta.stdev(close, bbLength)
upperBand = basis + dev
lowerBand = basis - dev

// Buy condition
buySignal = (rsi < rsiOversold) and (macdLine > signalLine) and (close < lowerBand)

// Sell condition
sellSignal = (rsi > rsiOverbought) and (macdLine < signalLine) and (close > upperBand)

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

// Plot Bollinger Bands
plot(upperBand, color=color.blue, linewidth=1, title="Upper Band")
plot(lowerBand, color=color.blue, linewidth=1, title="Lower Band")

// Plot MACD and Signal Line (optional, for reference)
hline(0, "Zero Line", color=color.gray)
plot(macdLine, color=color.blue, title="MACD Line")
plot(signalLine, color=color.orange, title="Signal Line")

// Alert conditions
alertcondition(buySignal, title="Buy Alert", message="Buy Signal")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal")
Candlestick analysis

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan