Systemicalpha

Schaff Trend Cycle

systemic:core-stcIndicatorsfunction1 cr

Inputs

NameTypeDescription
Slow WindowintegerThe period for the long (slow) EMA in the MACD calculation.
Fast WindowintegerThe period for the short (fast) EMA in the MACD calculation.
CycleintegerThe lookback period for the stochastic calculations applied to the MACD.
First Smooth FactorfloatSmoothing applied after the first stochastic calculation.
Second Smooth FactorfloatSmoothing applied after the second stochastic calculation (final output).
Price DatafloatarrayThe price series used to calculate the underlying MACD component of the STC.

Outputs

NameTypeDescription
STCfloatarrayThe Schaff Trend Cycle oscillator value, ranging from 0 to 100.

The Speed Problem

In the 1990s, currency trader Doug Schaff faced a frustration familiar to every technical analyst: the MACD was too slow. By the time it confirmed a trend, much of the move had already passed.

Schaff's insight was elegant: Why not apply stochastic calculations to MACD itself? The stochastic oscillator excels at measuring where a value sits within a recent range—applied twice in succession, it would compress the MACD's sluggish movements into a faster, bounded oscillator.

The result was the Schaff Trend Cycle—a hybrid indicator designed specifically for the fast-paced forex markets, where trend detection speed can mean the difference between profit and loss.


The Double Stochastic: Core Innovation

The STC's secret is its double stochastic smoothing:

flowchart TD
    subgraph Step1["Step 1: Calculate MACD"]
        Fast["Fast EMA (23)"]
        Slow["Slow EMA (50)"]
        MACD["MACD = Fast - Slow"]
    end
    
    subgraph Step2["Step 2: First Stochastic"]
        S1["Where is MACD within its range?"]
        PF["Percent F (smoothed)"]
    end
    
    subgraph Step3["Step 3: Second Stochastic"]
        S2["Where is Percent F within its range?"]
        STC["STC (0-100)"]
    end
    
    Fast & Slow --> MACD --> S1 --> PF --> S2 --> STC

Why does this work?

  1. MACD captures trend momentum (but unbounded and slow)
  2. First stochastic normalizes MACD to 0-100 and accelerates its turns
  3. Second stochastic further smooths while maintaining speed

The result oscillates between 0 and 100, with faster trend detection than the raw MACD.


Interpretation

STC ZoneReadingMarket Implication
Bullish75-100Strong uptrend; potential overbought
Neutral25-75Transition; trend developing or fading
Bearish0-25Strong downtrend; potential oversold

⚠️ Critical insight: Unlike RSI, values staying in extreme zones (>75 or <25) are often confirming a strong trend, not warning of reversal. Exit signals come when STC leaves these zones.


Trading Signals

Threshold Crossovers

SignalConditionInterpretation
BuySTC crosses above 25Leaving oversold; uptrend initiating
SellSTC crosses below 75Leaving overbought; downtrend initiating

Trend Confirmation

STC BehaviorWhat It Means
Holding > 75Strong uptrend in progress
Holding < 25Strong downtrend in progress
Oscillating 25-75Ranging market; use caution

Speed Advantage Over MACD

flowchart LR
    subgraph MACD_Signal["MACD Signal"]
        M1["Trend begins"]
        M2["MACD crosses signal line"]
        M3["Signal confirmed"]
    end
    
    subgraph STC_Signal["STC Signal"]
        S1["Trend begins"]
        S2["STC crosses 25/75"]
        S3["Earlier entry"]
    end
    
    M1 -->|"Lag"| M2 --> M3
    S1 -->|"Less lag"| S2 --> S3

In back-tests, STC often signals trend changes 3-5 bars earlier than traditional MACD crossovers.


Parameters

ParameterDefaultPurpose
Slow Window50Long EMA period for MACD calculation
Fast Window23Short EMA period for MACD calculation
Cycle10Stochastic lookback period
Smooth 13First stochastic smoothing factor
Smooth 23Second stochastic smoothing factor

Parameter Tuning

  • Shorter cycle (5-8): Faster signals, more noise
  • Longer cycle (12-20): Smoother, more lag
  • Smoothing factors: Higher = smoother but slower

When STC Excels

  • Strong trending markets — Catches trends early and holds
  • Forex and crypto — Designed for fast-moving, 24-hour markets
  • Swing trading — 4H and daily timeframes
  • Trend confirmation — As a filter alongside other indicators

When STC Struggles

  • Ranging/choppy markets — Oscillates without clear direction
  • Very short timeframes — Noise can overwhelm signals
  • Low-volatility assets — May produce false signals
  • Fundamental-driven moves — News events ignore technical levels

Missing Data

Gaps in price_data (closed-market weekends/holidays, missing prints) are None — never a sentinel 0.0 "buy signal", never a value fabricated through a still-warm ewm carried across the gap:

ScenarioOutput
Closed-market gapNone at that slot; the whole pipeline (both MACD EMAs, the cycle-window stochastic, both smoothing EMAs) resumes from the last observed bar's state, bridging the gap as an adjacent bar
Warm-up (not yet enough observed bars through every stage)None — never the retired fabricated 0.0
All bars missingEvery slot None, no crash
Live tick on a gap slot[None] — correct and non-starving, not the retired stale/carried value

Because STC's stochastic-of-stochastic-of-MACD state is recursive, a gap reappearing near the end of the series delays how quickly the indicator "catches up" after the gap resolves, the same way a resumed PSAR reversal lags a fresh one — this is a genuine cost of state-carry, not a bug.


IndicatorSpeedRangeBest Use
STCFastest0-100Early trend detection
MACDModerateUnboundedTrend strength/divergences
StochasticFast0-100Overbought/oversold reversals
RSIModerate0-100Momentum, divergences

Summary

AspectDetail
Full NameSchaff Trend Cycle
CreatorDoug Schaff (1990s)
Core IdeaDouble stochastic of MACD for speed
Range0-100
Buy SignalCrosses above 25
Sell SignalCrosses below 75
StrengthFaster than MACD, bounded output
WeaknessComplex, whipsaws in ranges

Indicator Assessment

%%{init: {'theme': 'base', 'themeVariables': {'quadrant1Fill': '#e8f5e9', 'quadrant2Fill': '#e3f2fd', 'quadrant3Fill': '#fff3e0', 'quadrant4Fill': '#fce4ec', 'quadrantTitleFill': '#f5f5f5'}}}%%
quadrantChart
    title STC - Complexity vs. Reliability
    x-axis Low Complexity --> High Complexity
    y-axis Low Reliability --> High Reliability
    quadrant-1 Efficient Power
    quadrant-2 Complex Value
    quadrant-3 Limited Use
    quadrant-4 Simple Trade-off
    STC-Stocks: [0.60, 0.60]
    STC-Crypto: [0.60, 0.55]

Five-Dimension Rating

DimensionStocksCryptoRationale
Popularity6/107/10Niche indicator; known in forex circles but less mainstream than MACD or RSI. Growing crypto awareness.
Reliability6/105.5/10Works well in trending markets but struggles in ranges. Higher volatility in crypto increases false signals.
Complexity6/106/10Double stochastic of MACD requires moderate understanding. Not beginner-friendly conceptually.
Versatility6/106.5/10Best for trending markets and swing trading. Limited use in mean-reversion or ranging scenarios.
Recent Interest5/106/10Steady but specialized interest. Crypto traders discovering its speed advantage over MACD.

Further Reading

Rendering diagrams...
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5