//@version=5
indicator("RSI Oversold Recovery", overlay=true)
// Input Parameters
rsiLen = input.int(14, "RSI Length", minval=1)
maLen = input.int(9, "MA Length", minval=1)
oversold = input.float(30, "Oversold Level", 0, 100)
overbought = input.float(70, "Overbought Level", 0, 100)
showLabels = input.bool(true, "Show Labels")
// Calculations
price = (high + low + close + open) / 4
rsi = ta.rsi(price, rsiLen)
rsiMA = ta.sma(rsi, maLen)
// State Management
var bool inOversoldTracking = false
var bool firstCrossDetected = false
var int daysInOversold = 0
// Condition Detection
isOversold = rsi < oversold
rsiCrossesMA = ta.crossover(rsi, rsiMA)
// State Logic
if isOversold and not inOversoldTracking
inOversoldTracking := true
firstCrossDetected := false
daysInOversold := 1
else if inOversoldTracking
if isOversold
daysInOversold += 1
if rsi >= oversold and not firstCrossDetected
inOversoldTracking := false
daysInOversold := 0
else if rsiCrossesMA and not firstCrossDetected
firstCrossDetected := true
else if isOversold and firstCrossDetected and rsiCrossesMA
// Buy Signal Condition
label.new(bar_index, low, "BUY\n" + str.tostring(rsi, "#.##"),
color=color.green, style=label.style_label_up, textcolor=color.white)
inOversoldTracking := false
daysInOversold := 0
// Visual Elements
if showLabels
if inOversoldTracking and not firstCrossDetected
label.new(bar_index, high, "WATCH\nRSI: " + str.tostring(rsi, "#.##"),
color=color.yellow, style=label.style_label_down)
if firstCrossDetected and inOversoldTracking
label.new(bar_index, high, "ALERT\nRSI: " + str.tostring(rsi, "#.##"),
color=color.orange, style=label.style_label_down)
// Plots
plotRSI = plot(ta.sma(close, 1), "Price", color=color.new(color.blue, 70))
plotMA = plot(ta.sma(close, 20), "MA", color=color.new(color.red, 70))
fill(plotRSI, plotMA, color=color.new(color.gray, 90))
// Alerts
alertcondition(inOversoldTracking and not firstCrossDetected, "Watch Mode", "Stock entered oversold territory")
alertcondition(firstCrossDetected and inOversoldTracking, "Alert Mode", "First RSI-MA cross detected")
alertcondition(isOversold and firstCrossDetected and rsiCrossesMA, "Buy Signal", "Buy condition met")
Overview
RSI is calculated on the average of open, high, low and close, with a moving average of the RSI. When RSI drops below the oversold level the script shows a watch label, marks an alert after RSI crosses its moving average, and prints a buy label when a second cross happens while still oversold. Alert conditions are provided for each stage. It also plots simple price averages.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
RSI Length
int
14
rsiLen
MA Length
int
9
maLen
Oversold Level
float
30
oversold
Overbought Level
float
70
overbought
Show Labels
bool
true
showLabels
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre
Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a
This indicator combines Bollinger Bands, RSI, Stochastic RSI, and volume spike detection to identify mean-reversion conditions during range-bound market regimes. It calculates Bollinger Band width to identify low-volatility states and triggers buy or sell sign
This overlay indicator calculates the 14-period Relative Strength Index to identify overbought and oversold market conditions. When RSI crosses key thresholds, it plots initial long or short entry labels directly on the price chart. If price continues moving a
RSI Technique - V identifies rapid reversal pivot points based on the Relative Strength Index. It monitors an RSI oscillator, configurable via the lookback setting, looking for sharp V-shaped spikes around extreme zones. A bullish signal appears when the indic
Commodity Heat Reversal plots score-based mean-reversion reversal markers on the price chart for commodity futures, aimed at the four-hour timeframe. It builds separate long and short heat scores from ATR distance to a mean moving average, ATR expansion, RSI e