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

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité