Skip to content

Free MT5 indicator

Schaff Trend Cycle

Schaff Trend Cycle for MT5: MACD run through two smoothed stochastics, with 25/75 levels and arrows on confirmed level crosses.

Momentumv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Non-repainting signals Alerts

What it does

Schaff Trend Cycle (STC) combines the trend-following MACD with the cycle-timing stochastic. The result is a line between 0 and 100 that tends to sit at the extremes during trends and to swing quickly between them when the trend changes. The line is green while rising and red while falling.

Arrows mark closed bars where STC rises through the lower level (25) or falls through the upper level (75).

How it works

  1. MACD = EMA(23) − EMA(50) of the close.
  2. First stochastic: %K1 = 100 × (MACD − lowest MACD) ÷ (highest MACD − lowest MACD) over the last 10 bars. If the range is zero, the previous value is kept.
  3. Smoothed: PF = previous PF + 0.5 × (%K1 − previous PF).
  4. Second stochastic: %K2 = 100 × (PF − lowest PF) ÷ (highest PF − lowest PF) over the last 10 bars.
  5. STC = previous STC + 0.5 × (%K2 − previous STC).
  6. Bullish arrow: STC closes above 25 after being at or below 25. Bearish arrow: STC closes below 75 after being at or above 75.

The double stochastic step is what makes STC faster than MACD while staying smoother than a plain stochastic.

How to use it

  • STC holding near 100 describes a persistent uptrend; holding near 0 a persistent downtrend.
  • A rise through 25 suggests a new upward cycle is starting; a fall through 75 suggests a downward cycle.
  • Signals in the direction of a higher-timeframe trend are usually more reliable than counter-trend ones. A simple filter is to take only bullish crosses while price is above a long moving average.
  • Because STC flattens at the extremes, a line stuck at 100 does not by itself mean the market is overbought.
  • Background on the MACD part is in the MACD Indicator lesson.

Settings

InputDefaultWhat it changes
MACD fast / slow EMA23 / 50The trend component; shorter values react faster
Cycle length10Lookback of both stochastic passes
Smoothing factor0.5Lower values smooth more and delay signals
Lower / upper level25 / 75Where arrow crosses are measured
Pop-up alert / Push notificationfalse / falseOne alert per closed bar on a new level cross

Limitations

  • STC can swing from one extreme to the other on small price moves, especially with short cycle lengths, which creates false signals in quiet markets.
  • In very strong trends it may stay pinned at 0 or 100 and give no fresh signal for a long time.
  • The recursive smoothing means early values on a short history are less reliable.
  • The live bar's value changes with each tick; arrows and alerts wait for the bar close.
  • Use STC as one input, together with a stop-loss and sound position sizing. Trading involves substantial risk of loss.

Key inputs

Key inputs of Schaff Trend Cycle
InputDefaultDescription
MACD fast EMA length23Faster EMA of the underlying MACD.
MACD slow EMA length50Slower EMA of the underlying MACD.
Cycle (stochastic) length10Lookback for both stochastic passes.
Stochastic smoothing factor (0-1)0.5Weight given to each new stochastic value; lower is smoother.
Lower / upper level25 / 75Levels whose crosses produce arrows.
Pop-up alert on new level crossfalseAlerts once when a closed bar confirms a level cross.

Educational tools, not advice. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 indicators