Search
Products
Community
Markets
News
Brokers
More
IN
Get started
U.S. Dollar / Japanese Yen
Mar 27, 2023
Rsi
0
Grab this chart
Grab this chart
//
version
=5
strategy("RSI Strategy", overlay=true)
// Define input variables
rsi_length = input(14, title="RSI Length")
rsi_buy = input(30, title="RSI Buy Threshold")
rsi_sell = input(70, title="RSI Sell Threshold")
// Calculate RSI
rsi_value = rsi(close, rsi_length)
// Define buy and sell signals
buy_signal = rsi_value < rsi_buy
sell_signal = rsi_value > rsi_sell
// Enter long position on buy signal
if (buy_signal)
strategy.entry("Buy", strategy.long)
// Exit long position on sell signal
if (sell_signal)
strategy.close("Buy")
// Plot RSI
plot(rsi_value, title="RSI", color=color.blue)
// Plot buy and sell signals
plotshape(buy_signal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(sell_signal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)
danial37
Follow
Technical Indicators
danial37
Follow
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the
Terms of Use
.