The Schaff Trend Cycle (STC) is what you get when a currency trader gets tired of MACD crossovers arriving late and decides to squeeze the MACD line through a stochastic, twice. The output is a line stuck between 0 and 100 that tends to turn before a plain MACD crossover does. For swing traders on NSE stocks, that speed is the whole appeal. It is also the whole risk, and we’ll get to both.
This guide covers where the indicator came from, the exact maths behind it, a worked calculation you can redo on paper, and a full hypothetical swing trade on an Indian stock with position sizing. If you are new to oscillators in general, our technical analysis guide for Indian stocks is a better starting point.
In this article
- Where the Schaff Trend Cycle came from
- The Schaff Trend Cycle formula, step by step
- A worked calculation you can check on paper
- Reading the 25 and 75 lines
- STC versus MACD and plain stochastics
- A hypothetical swing trade with the Schaff Trend Cycle
- Settings: should you change 23, 50 and 10?
- Where the Schaff Trend Cycle goes wrong
- A simple checklist before taking an STC signal
Where the Schaff Trend Cycle came from
Doug Schaff built the STC for forex trading. In his paper “Releasing the Code to the Schaff Trend Cycle”, he describes trying to reconcile two methods that often disagreed: the MACD, which tracks two exponential moving averages moving apart and together, and price cycles, read through smoothed stochastics. His fix was simple in concept. Take the MACD line and run it through a double smoothed stochastic.
Schaff’s own claims for it are worth reading with a raised eyebrow, but they explain the design. He wrote that the STC produces less whipsaw and fewer false signals than MACD or cycle oscillators, and that it usually turns up or down earlier than a MACD crossover. That is the author talking about his own tool. Treat it as a hypothesis to test on your own charts, not a fact.
The Schaff Trend Cycle formula, step by step
The indicator has three inputs. In Schaff’s published code, and in the TA-Lib reference for STC, the defaults are a fast EMA of 23, a slow EMA of 50, and a cycle length of 10. The smoothing factor is fixed at 0.5.
- MACD line. Fast EMA minus slow EMA of the closing price. With defaults, that is EMA(23) minus EMA(50).
- First stochastic. Over the last 10 bars, find the highest and lowest MACD values. Frac1 = 100 × (current MACD minus lowest MACD) ÷ (highest MACD minus lowest MACD).
- First smoothing. PF = previous PF + 0.5 × (Frac1 minus previous PF).
- Second stochastic. Same idea, but now applied to PF. Frac2 = 100 × (current PF minus lowest PF over 10 bars) ÷ (highest PF minus lowest PF over 10 bars).
- Second smoothing. STC = previous STC + 0.5 × (Frac2 minus previous STC).
One detail people miss: if the high-low range in either stochastic step is zero, the fraction just keeps its previous value instead of dividing by zero. Both the original EasyLanguage code and TA-Lib handle it this way.
Why the cycle length of 10? Schaff explained that the double stochastic’s length is set to about half of the cycle you want to track. He observed that most currencies show a recurring cycle of roughly 17 to 22 bars, which he called the 20-bar cycle, so 10 became the default. Nobody has proved that Nifty stocks follow the same rhythm. That is the first thing to keep in mind before you trust the defaults blindly.
STC is MACD run through two stochastics. It turns faster because it is measuring where MACD sits inside its own recent range, not where MACD sits against zero.
A worked calculation you can check on paper
Let’s run one bar through both stages. These numbers are made up for illustration, not taken from any real stock.
Stage one. Say the MACD line over the last 10 bars has a high of 6.0 and a low of minus 2.0, and today’s MACD is 4.0.
- Range = 6.0 minus (minus 2.0) = 8.0
- Frac1 = 100 × (4.0 minus (minus 2.0)) ÷ 8.0 = 100 × 6 ÷ 8 = 75
- Yesterday’s PF was 60. So PF = 60 + 0.5 × (75 minus 60) = 60 + 7.5 = 67.5
Stage two. Now suppose PF over the last 10 bars, including today’s 67.5, ranged from 40 to 70.
- Frac2 = 100 × (67.5 minus 40) ÷ (70 minus 40) = 100 × 27.5 ÷ 30 = 91.67 (rounded)
- Yesterday’s STC was 80. So STC = 80 + 0.5 × (91.67 minus 80) = 85.83 (rounded)
Look at what happened. MACD is at 75% of its 10-bar range, which is decent but not extreme. After the second stochastic, the reading jumps into the mid-80s, because PF is near the top of its range. That is the stretching effect. The double stochastic pushes readings towards the extremes, which is why STC spends a lot of time pinned near 0 or 100 and then moves across the middle quickly.
The 0.5 smoothing also matters more than it looks. Feed a smoother starting at 0 a steady input of 100 and it reads 50, then 75, then 87.5, then 93.75. Each bar closes half the remaining gap. Fast, but not instant.
Reading the 25 and 75 lines
Schaff’s code plots two reference lines at 25 and 75. His reading, also summarised in the TA-Lib notes, goes like this:
- A turn up from below 25 is the bullish signal.
- A turn down from above 75 is the bearish signal.
- In a strong rally, STC can climb to 100 and stay there until the trend slows. In a strong fall, it can sit at 0.
That last point catches beginners. An STC flat at 100 is not “overbought, time to short”. In Schaff’s framing, it is a trend that is still accelerating. The signal comes when it finally hooks down from above 75, not while it is parked at the top.
Sideways markets are different. Schaff described the STC there as behaving like a normal range oscillator, travelling from under 25 to over 75 in a fairly clean path. On a stock stuck in a ₹100 range for weeks, those swings can line up neatly with the edges of the range. On a stock that is drifting, they often don’t.
STC versus MACD and plain stochastics
It helps to think of the three side by side.
| Indicator | What it measures | Bounded? | Typical weakness |
|---|---|---|---|
| MACD | Gap between two EMAs | No | Crossovers come late |
| Stochastic | Close relative to recent high-low range | 0 to 100 | Whipsaws in strong trends |
| Schaff Trend Cycle | MACD relative to its own recent range, smoothed twice | 0 to 100 | Can flip fast in choppy markets; long flat spells at 0 or 100 |
Because MACD has no ceiling or floor, you can’t say “MACD is high” without comparing it to that stock’s history. STC solves that by normalising. The cost is that you lose information about how strong the trend is in absolute terms. A small MACD wiggle in a dead stock can still produce a full 0 to 100 swing on STC, because the range it’s measured against is tiny.
If you like this family of tools, our posts on the TRIX indicator and the True Strength Index cover two other ways traders smooth momentum to cut noise.
A hypothetical swing trade with the Schaff Trend Cycle
Here is how we’d frame a trade. Every number below is example data for a made-up stock, not a recommendation.
The setup. Stock XYZ trades on NSE. On the daily chart the 50-day EMA is rising, so the bigger trend is up. Price pulls back for a couple of weeks, and STC drops to 18. Then, on a day when XYZ closes at ₹1,240, STC hooks up to 31, crossing back above 25. The most recent swing low during the pullback was ₹1,205.
The stop. We place the stop a little below that swing low, at ₹1,198. Risk per share = ₹1,240 minus ₹1,198 = ₹42.
The size. Assume a trading account of ₹5,00,000 and a rule of risking 1% per trade, which is ₹5,000. Quantity = ₹5,000 ÷ ₹42 = 119.05, so we round down to 119 shares. Actual risk = 119 × ₹42 = ₹4,998. The position costs 119 × ₹1,240 = ₹1,47,560 before charges.
The exit plan. Two options people commonly use:
- A fixed target of 2R, meaning twice the risk. That is ₹1,240 + (2 × ₹42) = ₹1,324.
- Or let it run and exit when STC turns down from above 75, with the stop trailed under each new swing low.
Our view: the second option suits the indicator better, but only if you accept giving back a chunk of open profit while you wait for the hook down. Neither choice changes the stop, and the stop is what keeps a bad trade at ₹5,000. Our risk management guide goes deeper on sizing and stops.
The STC tells you when momentum might be turning. It says nothing about how much you should lose if it is wrong. That part is your job.
Settings: should you change 23, 50 and 10?
Schaff himself didn’t treat the defaults as sacred. In the same paper he wrote that he sometimes used smaller EMA lengths on longer timeframes, such as 12 and 26 or 7 and 13 on weekly charts, and longer lengths on short intraday charts, giving 115 and 240 on a 10-minute chart as one experiment. He also noted that a shorter cycle length such as 5 gives more turns, and a longer one gives fewer.
Practical rules we’d follow:
- Change one input at a time. Changing all three together makes it impossible to know what helped.
- Test on more than one stock. A setting tuned to one Nifty name over one year is usually just fitted to noise.
- Remember the warm-up. STC is recursive. TA-Lib notes that the output depends on how much history comes before it, so the first readings on a fresh chart are less reliable. Two platforms can show slightly different values for the same bar for this reason, and also because they seed the EMAs differently.
Where the Schaff Trend Cycle goes wrong
No indicator gets a free pass here.
Choppy, rangebound stocks with small ranges. Because STC normalises MACD against its own recent range, a stock that barely moves can still produce dramatic swings on the indicator. The signal looks loud. The underlying move is tiny. Check the actual price range before acting.
Gaps. Stocks can gap around results, block deals and overnight global cues. An STC buy signal at ₹1,240 means little if the stock opens 4% lower next morning below your stop. Daily-chart traders should know the results calendar for anything they hold.
Strong trends. When STC sits at 100 for weeks, traders who read it as an overbought sell get run over. When it sits at 0, the bottom-fishers suffer. Use a trend filter, such as the slope of a longer EMA, and only take signals in that direction.
Speed cuts both ways. An indicator that turns earlier also turns wrongly more often in noise. The 0.5 smoothing helps, but it doesn’t remove the problem.
A simple checklist before taking an STC signal
- Is the higher-timeframe trend in the same direction as the signal?
- Did STC actually hook back across 25 or 75, rather than just touching it?
- Is there a clear swing level for the stop, and is the risk per share sensible relative to the stock’s normal daily range?
- Are results or a corporate action due before your expected holding period ends?
- Have you sized the position from the stop, not from how confident you feel?
The Schaff Trend Cycle is a clever bit of engineering: MACD for trend, a double stochastic for timing, and a fixed half-step smoother to calm it down. Used as a timing tool inside a trend you have already identified, it can earn its place on the chart. Used alone as a buy-and-sell button, it will mostly teach you about whipsaws.
Disclaimer: This article is for educational purposes only and is not investment advice. All prices, trades and indicator values in the examples are hypothetical. Trading in equities involves risk, including loss of capital. Please consult a SEBI-registered investment adviser before making investment decisions.

Leave a Reply
Join the conversation
Commenting is open to registered readers. Sign up with just your email — no password needed, and it takes under a minute.
Sign up to comment Log in