The RSI Swing Points Indicator draws Wilder’s failure swings on the price chart: an RSI extreme, a rally or a pullback, a second swing that fails to reach the extreme again, and the moment the RSI breaks the middle point of the figure. Wilder considered it the strongest RSI signal, because it does not depend on price making a new high or low.
This screener runs the same engine over every stock in a list and returns the ones where a failure swing has fired in the last three bars, with the RSI at each point of the figure.
Bottom failure swing:
Top failure swing: the mirror image above the upper level (70).
A swing that has not fired 120 bars after A is dropped. Pivots are confirmed two bars after they print, so A and C are known with that delay, exactly as on the chart.
Measured on the current S&P 500 members with daily data since January 2019: a failure swing fires on 1.4% of the bars. With the three-bar window the screener returns a median of 17 stocks a day (3.5% of the list), 37 or fewer on nine days out of ten, and more on days of extreme market moves. Top swings are more frequent than bottom swings in a rising market.
Use the same values as on the indicator: if they differ, the screener and the chart describe different swings.
//---------------------------------------------------------------
// PRC_RSI Swing Screener
// version = 0
// 27.11.2026
// Iván González @ www.prorealcode.com
// Author: AlgoNorth (RSI Swing Points indicator)
// Sharing ProRealTime knowledge
//--------------------------------------------------------------------//
// Lists the stocks where a Wilder failure swing of the RSI Swing Points
// indicator has just fired: bottom swing (A below the lower level, a higher
// low C that holds, RSI closes above the rally high B) or top swing (the
// mirror above the upper level). Same engine and defaults as the indicator.
//--------------------------------------------------------------------//
// --- RSI swing points
rsiLen = 14 // RSI length
pivL = 3 // pivot left bars
pivR = 2 // pivot right bars: A and C are known this many bars after they print
maxSpan = 120 // a swing that has not fired this many bars after A is dropped
// --- RSI levels
hiLvl = 70 // upper level (overbought): a top failure swing needs A above it
loLvl = 30 // lower level (oversold): a bottom failure swing needs A below it
// ===================== RSI (Wilder, built like the platform RSI)
ONCE avgUp = 0
ONCE avgDn = 0
ONCE rsiOk = 0
IF barindex >= 1 THEN
chg = close - close[1]
ELSE
chg = 0
ENDIF
upC = max(chg, 0)
dnC = max(0 - chg, 0)
IF barindex = rsiLen THEN
avgUp = summation[rsiLen](upC) / rsiLen
avgDn = summation[rsiLen](dnC) / rsiLen
rsiOk = 1
ELSIF barindex > rsiLen THEN
avgUp = (avgUp[1] * (rsiLen - 1) + upC) / rsiLen
avgDn = (avgDn[1] * (rsiLen - 1) + dnC) / rsiLen
ENDIF
IF rsiOk = 1 THEN
IF avgDn = 0 THEN
rsiV = 100
ELSIF avgUp = 0 THEN
rsiV = 0
ELSE
rsiV = 100 - 100 / (1 + avgUp / avgDn)
ENDIF
ELSE
rsiV = undefined
ENDIF
// ===================== FAILURE SWING MACHINES
// Bottom swing: A = RSI pivot low below the lower level, B = the rally high,
// C = a higher pivot low that holds; it fires when RSI closes above B.
// The top swing runs the same machine on the mirrored RSI (100 - RSI).
ONCE bSt = 0
ONCE tSt = 0
plOk = 0
phOk = 0
IF barindex >= rsiLen + pivL + pivR THEN
IF rsiV[pivR] < lowest[pivR](rsiV) AND rsiV[pivR] <= lowest[pivL](rsiV)[pivR + 1] THEN
plOk = 1
plV = rsiV[pivR]
ENDIF
IF rsiV[pivR] > highest[pivR](rsiV) AND rsiV[pivR] >= highest[pivL](rsiV)[pivR + 1] THEN
phOk = 1
phV = rsiV[pivR]
ENDIF
ENDIF
px = barindex - pivR
fireBull = 0
fireBear = 0
IF rsiOk = 1 THEN
// --- bottom machine
IF bSt > 0 AND barindex - bAX > maxSpan THEN
bSt = 0
ENDIF
IF plOk = 1 THEN
IF plV < loLvl AND (bSt <> 1 OR plV < bAV) THEN
bAV = plV
bAX = px
bSt = 1
ELSIF bSt = 2 OR (bSt = 3 AND plV < bCV) THEN
// B is the rally's high: it moves to any bar before C where RSI went higher
kEnd = barindex - bBX - 1
IF kEnd > pivR THEN
FOR k = pivR + 1 TO kEnd DO
IF rsiV[k] > bBV THEN
bBV = rsiV[k]
bBX = barindex - k
ENDIF
NEXT
ENDIF
bCV = plV
bSt = 3
ENDIF
ENDIF
IF phOk = 1 AND (bSt = 1 OR (bSt = 2 AND phV > bBV)) THEN
bBV = phV
bBX = px
bSt = 2
ENDIF
// C has to hold: a close with RSI back past the level drops the swing
IF bSt = 3 AND rsiV < loLvl THEN
bSt = 0
ENDIF
IF bSt = 3 AND rsiV > bBV THEN
fireBull = 1
bSt = 0
ENDIF
// --- top machine (mirrored RSI)
mHi = 100 - hiLvl
IF tSt > 0 AND barindex - tAX > maxSpan THEN
tSt = 0
ENDIF
IF phOk = 1 THEN
tLo = 100 - phV
IF tLo < mHi AND (tSt <> 1 OR tLo < tAV) THEN
tAV = tLo
tAX = px
tSt = 1
ELSIF tSt = 2 OR (tSt = 3 AND tLo < tCV) THEN
kEnd = barindex - tBX - 1
IF kEnd > pivR THEN
FOR k = pivR + 1 TO kEnd DO
IF 100 - rsiV[k] > tBV THEN
tBV = 100 - rsiV[k]
tBX = barindex - k
ENDIF
NEXT
ENDIF
tCV = tLo
tSt = 3
ENDIF
ENDIF
IF plOk = 1 THEN
tHi = 100 - plV
IF tSt = 1 OR (tSt = 2 AND tHi > tBV) THEN
tBV = tHi
tBX = px
tSt = 2
ENDIF
ENDIF
IF tSt = 3 AND 100 - rsiV < mHi THEN
tSt = 0
ENDIF
IF tSt = 3 AND 100 - rsiV > tBV THEN
fireBear = 1
tSt = 0
ENDIF
ENDIF
// ===================== SCREENER OUTPUT
// The signal is computed once, on the bar where it fires. maxAge only says how
// many bars back it is still listed (capture window), with the columns of the
// bar that fired. The chart keeps the marks forever; the screener only sees
// the last maxAge bars.
maxAge = 3 // bars in which a fired swing is still listed (1 = only today)
sDir = 0
IF fireBull = 1 THEN
sDir = 1
sA = bAV
sB = bBV
sC = bCV
sSpan = barindex - bAX
ELSIF fireBear = 1 THEN
sDir = -1
sA = 100 - tAV
sB = 100 - tBV
sC = 100 - tCV
sSpan = barindex - tAX
ENDIF
ageS = 0
colDir = 0
colA = 0
colB = 0
colC = 0
colSpan = 0
IF barindex >= maxAge THEN
FOR n = 0 TO maxAge - 1 DO
IF ageS = 0 AND sDir[n] <> 0 THEN
ageS = n + 1
colDir = sDir[n]
colA = round(sA[n] * 10) / 10
colB = round(sB[n] * 10) / 10
colC = round(sC[n] * 10) / 10
colSpan = sSpan[n]
ENDIF
NEXT
ENDIF
barsAgo = ageS - 1
SCREENER[ageS > 0](colDir AS "1 bottom -1 top", colA AS "RSI at A", colB AS "RSI at B", colC AS "RSI at C", colSpan AS "Bars A to fire", barsAgo AS "Bars ago")
Based on the RSI Swing Points indicator by AlgoNorth, published open source under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International licence (CC BY-NC-SA 4.0); this screener is shared under the same licence.