OPEN-SOURCE SCRIPT

Call and Put Signals with Alerts

//version=5
indicator("Call and Put Signals with Alerts", overlay=true)

// Input parameters for the RSI and Moving Averages
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
shortMaLength = input.int(50, title="Short MA Length")
longMaLength = input.int(200, title="Long MA Length")

// Calculate the RSI and Moving Averages
rsi = ta.rsi(close, rsiLength)
shortMa = ta.sma(close, shortMaLength)
longMa = ta.sma(close, longMaLength)

// Define the conditions for Call (Buy) and Put (Sell) signals
callCondition = (rsi < rsiOversold) and (shortMa > longMa) // RSI oversold and short MA above long MA (bullish)
putCondition = (rsi > rsiOverbought) and (shortMa < longMa) // RSI overbought and short MA below long MA (bearish)

// Plot Call and Put signals on the chart
plotshape(series=callCondition, location=location.belowbar, color=color.green, style=shape.labelup, title="Call Signal", text="CALL")
plotshape(series=putCondition, location=location.abovebar, color=color.red, style=shape.labeldown, title="Put Signal", text="PUT")

// Plot the Moving Averages for trend visualization
plot(shortMa, color=color.blue, title="Short MA")
plot(longMa, color=color.orange, title="Long MA")

// Alert conditions for Call and Put signals
alertcondition(callCondition, title="Call Alert", message="Call (Buy) Signal - RSI Oversold & Short MA > Long MA")
alertcondition(putCondition, title="Put Alert", message="Put (Sell) Signal - RSI Overbought & Short MA < Long MA")
forecasting

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é