The Schaff Trend Cycle (STC) is one of those oscillators that traders love.
Doug Schaff started from a simple observation: the MACD trends in cycles, but it is slow and unbounded. The STC runs the MACD through a double stochastic with double smoothing, which:
The standard reading is oversold below 25 and overbought above 75. The useful signal is not the level itself but the turn: the STC crossing up through 25 (leaving oversold — a potential bottom) or down through 75 (leaving overbought — a potential top).
On every instrument it evaluates one event on the last closed bar:
Output columns:
//----------------------------------------------
//PRC_Schaff Trend Cycle - Screener
//version = 1
//18.06.2026
//Ivan Gonzalez @ www.prorealcode.com
//Sharing ProRealTime knowledge
//----------------------------------------------
fastLength = 23
slowLength = 50
cycleLength = 10
mymacd = average[fastLength,1](close) - average[slowLength,1](close)
ll1 = lowest[cycleLength](mymacd)
rg1 = highest[cycleLength](mymacd) - ll1
k1 = (mymacd - ll1) / max(rg1, 0.000001) * 100
pf = average[3,1](k1)
ll2 = lowest[cycleLength](pf)
rg2 = highest[cycleLength](pf) - ll2
k2 = (pf - ll2) / max(rg2, 0.000001) * 100
stc = average[3,1](k2)
longSignal = stc crosses over 25
shortSignal = stc crosses under 75
signalDir = 0
if longSignal then
signalDir = 1
endif
if shortSignal then
signalDir = -1
endif
SCREENER[longSignal OR shortSignal](stc AS "STC", signalDir AS "Señal", close AS "Cierre")