Skip to content

charton API


charton API / @chart-on/ta / schaffTrendCycle

Function: schaffTrendCycle() ​

schaffTrendCycle(values, fast, slow, cycle, out?, state?): Float64Array

Defined in: smi-stc.ts:126

Schaff trend cycle, 0 to 100: the MACD line (ema(fast) - ema(slow)) put through a stochastic over cycle bars, smoothed as prev + 0.5 * (raw - prev), then a second stochastic of that over cycle bars, smoothed the same way. Each smoothing has no previous value on its first bar with a full window (and again after a NaN), so it takes the raw stochastic there instead of moving halfway. A zero range keeps the previous value, or reads 50 with none. Lookback max(fast, slow) + 2 * cycle - 3.

Pass state to keep the intermediate lines for schaffTrendCycleAt.

Parameters ​

values ​

Series

fast ​

number

slow ​

number

cycle ​

number

out? ​

Float64Array<ArrayBufferLike>

state? ​

SchaffTrendCycleState

Returns ​

Float64Array