Schaff Trend Cycle: the MACD run through a stochastic twice, each pass
smoothed, so the trend the MACD measures turns into a cycle that spends its
time pinned near 0 or 100 and moves between them quickly.
macd = ema(source, fast) - ema(source, slow)
f1 = 100 * (macd - lowest(macd, cycle)) / (highest(macd, cycle) - lowest(macd, cycle))
pf = pf[1] + factor * (f1 - pf[1]), seeded on the first f1
f2 = the same stochastic of pf over cycle
stc = stc[1] + factor * (f2 - stc[1]), seeded on the first f2
A window with no range repeats the stochastic's previous reading, and before
there is one the bar is absent, so a series that never moves prints nothing.
The first value lands at slow + 2 * cycle - 3: the MACD's warmup, then one
full window for each stochastic, bar 67 at the defaults.
Schaff Trend Cycle: the MACD run through a stochastic twice, each pass smoothed, so the trend the MACD measures turns into a cycle that spends its time pinned near 0 or 100 and moves between them quickly.
macd = ema(source, fast) - ema(source, slow) f1 = 100 * (macd - lowest(macd, cycle)) / (highest(macd, cycle) - lowest(macd, cycle)) pf = pf[1] + factor * (f1 - pf[1]), seeded on the first f1 f2 = the same stochastic of pf over cycle stc = stc[1] + factor * (f2 - stc[1]), seeded on the first f2
A window with no range repeats the stochastic's previous reading, and before there is one the bar is absent, so a series that never moves prints nothing. The first value lands at
slow + 2 * cycle - 3: the MACD's warmup, then one full window for each stochastic, bar 67 at the defaults.