Automated Schaff Trend Cycle Forex Strategy

Sep 2, 2021

The Schaff Trend Cycle (STC) is the perfect tool for traders hoping to capture price swings within a long-term trend.

In this post, I’ll cover the following aspects of the STC:

  1. Calculation and Interpretation
  2. Comparisons vs. the MACD and Stochastic
  3. Limitations

Then I’ll use it to build a trend following strategy for the USDJPY, and backtest it over 10 years.

Download the complete strategy in the Free Strategies section.

A great feature about StrategyQuant is its regular addition of new indicators to the platform.

One recent addition is the Schaff Trend Cycle (STC).

Seeing how Investopedia described it as ‘faster and more accurate’, I knew I had to check it out.

Let’s see how we can put it to good use!

What’s the Schaff Trend Cycle?

The STC was developed by Doug Schaff of FX-Strategy, who publicly released it in 2008.

It is an ingenious combination of the popular MACD and Stochastic indicators, and is built on the premise that currency trends accelerate and decelerate in cycles.

The STC is not included with MT4 by default; you can download it here for free.

Here’s how it looks like in MT4:

Schaff Trend Cycle Calculation

The STC is created by running the MACD through a double-smoothed stochastic calculation. The Stochastic’s %K and %D calculations will come in handy.

I’ll use the STC’s default parameters below.

The resulting STC oscillator thus combines the benefits of trend (MACD) and momentum (Stochastic) indicators.

The inclusion of the Stochastic in step 2 is based on Schaff’s observation that currencies often exhibit cyclical behaviour within a long-term trend.

According to Schaff, most currencies have 20-period recurring cycles, meaning there are about 20 periods between successive swing highs/lows.

A 10-period lookback, which is half the estimated length of the time cycle, is therefore chosen for the Stochastic calculations.

Depending on your market’s characteristics, you can vary the Stochastic lookback to speed up or slow down the STC. A shorter lookback will produce more oscillator turns, while a longer lookback will produce fewer, but perhaps more accurate turns.

Interpreting the Schaff Trend Cycle Indicator

Like the Stochastic, the STC oscillates between 0 and 100. It is commonly used to detect market direction and predict turning points.

The STC rises rapidly in an uptrend, and falls in a downtrend. 

The 25 and 75 levels are commonly used to denote oversold and overbought conditions, respectively. These levels are great for detecting swing highs and lows in trending markets.

The chart below shows how the STC is able to quickly detect pullbacks in a long-term downtrend.

In sideways markets, the STC can be interpreted similarly to standard oscillators.

When the STC crosses above the 25 line, the market could be exiting oversold conditions and reverting towards the mean. Likewise, when it crosses below the 75 line, it could be exiting overbought conditions.

Schaff Trend Cycle vs. MACD Indicator

Since the STC is a derivative of the MACD, it is frequently compared to the MACD.

The MACD is simply the difference between the 12 and 26-period EMAs. A signal line, which is the 9-period EMA of the MACD, is often plotted together.

Trend followers may use these indicators to detect emerging uptrends using the following rules:

  • STC: Crosses over 25
  • MACD: Main line crosses over signal line

Compared to the MACD, the STC usually reacts faster to prices. The chart below shows how the STC produces earlier entry and exit signals for a short trade, helping you capture a larger portion of the price swing.

For sideways markets, the STC’s oscillation between 0 and 1 makes it convenient to detect overbought/oversold conditions. The MACD, in contrast, has no minimum or maximum value.

Schaff Trend Cycle vs. Stochastic Indicator

The Stochastic’s %K line measures the location of the current close relative to the high-low range over the lookback period. A 3-period SMA of the %K, called the %D, is often plotted together.

When used for trend following, uptrends are signalled when the %K crosses over the %D. Compared to the STC, the Stochastic tends to be choppier, producing a large number of false signals.

The chart below compares the STC to the Stochastic. Notice how the %K repeatedly crosses over/under the %D in the uptrend, whereas the STC remains stable.

When used for mean reversion in rangebound markets, I find the performance of the STC and Stochastic to be generally similar.

Note that the Stochastic traditionally uses the 20/80 levels to denote oversold/overbought conditions, unlike 25/75 for the STC.

Schaff Trend Cycle Limitations

1. Whipsaws

While its fast reaction can be beneficial, I generally find the default STC produces too many false overbought/oversold signals.

When riding a trend, even a gentle pullback or consolidation can cause the STC to swing all the way to the opposite extreme.

The chart below shows the STC repeatedly moving into the oversold zone although the uptrend is clearly still present.

If you’re a short-term trader, I recommend lengthening the lookback periods used for the STC’s MACD component. By default, the MACD calculates the difference between a 23 and 50-period EMA.

For example, when trading on the hourly chart, I prefer to use the 50 and 100-period EMAs.

On higher timeframes, where price action is usually smoother, shorter EMAs like the default 23/50 should work well.

Here’s how the revised STC looks like on the same chart:

The whipsaws are now gone, consistent with the appearance of the trend.

2. Prolonged Overbought/Oversold Periods

Like other momentum oscillators, the STC can spend long periods in the overbought/oversold regions when applied to a trending market.

If you’re a mean reversion trader using the STC in isolation, you could get a whole bunch of false entries.

To alleviate this, you can include additional trend detection indicators in your strategy, and only trade in the direction of the longer-term trend.

Schaff Trend Cycle Trading Strategy

Schaff recommended using the STC to trade the cycles within trends.

This means entering after a short-term pullback, hopefully riding the trend to the next swing high/low.

The figure below illustrates a successful short trade.

Let’s develop a strategy for the hourly USDJPY. I’ll explain the conditions for long entries; short entries are symmetrical.

The key entry condition is the STC crossing above the 25 level. This signals the end of the pullback and an exit from oversold territory.

My main concern is to minimize the number of whipsaw entries.

I’ll use the longer MACD lookback periods (50, 100) for the STC as explained above. For additional defence, I will include two more safeguards:

1. Two EMAs for Trend Detection

I want to trade in the direction of the short and mid-term trends.

For a valid entry, the market must close above EMA(20), which is in turn must close above EMA(50).

2. Stop Entry for Price Confirmation

To confirm the trend is indeed resuming after the pullback, I’ll place a stop order above the current market price.

I’ll use the highest high over the past 10 periods for the entry, which will be valid for 3 bars.

To summarize, this is how a long signal is triggered:

How about trade management?

The STC provides a couple of options for profit targets.

An aggressive option would be to take profits when the STC becomes flat in the overbought region. An alternative is to take profits when the STC crosses under the 75 level, which is sometimes right after a swing high occurs.

As illustrated above, I find both these options to be premature. Many times you’ll end up exiting a trade before a sizeable profit has accrued, or even when you’re still in a loss.

I prefer to give my trend trades a little more breathing space, so I’ll use a 5*ATR profit target instead.

A 2*ATR stop loss will complete the strategy, giving me a 2.5 reward-to-risk ratio.

AlgoWizard Programming

Here are the entry conditions programmed using AlgoWizard’s pseudocode editor:

There are pre-programmed STC cross over/under conditions to help you out:

And finally the stop entry and trade management:

Schaff Trend Cycle Backtest Results

I backtested the STC strategy on the 1-hour USDJPY over the last 10 years.

A fixed 0.1 lots was used throughout the backtest to remove the effects of position sizing.

The low 33% win rate is a natural consequence of the 2.5:1 reward-to-risk ratio. Perhaps some optimization will result in a more profitable compromise between these variables.

If you download the strategy and optimize its parameters, you can modify the ‘Profit_Mult’ and ‘Stop_Mult’ variables, which control the size of the profit target and stop loss, respectively.

Wrapping Up

So does the Schaff Trend Cycle live up to its hype?

I think the STC’s unique combination of trend and momentum detection makes it best suited for trend followers taking advantage of short-term pullbacks.

For this purpose, it’s a mild improvement over the MACD, as long as you select appropriate lookback periods for the STC’s MACD component. As demonstrated above, longer lookbacks tend to work better on the lower timeframes.

A STC strategy that attempts to capture price swings can be a good complement to longer-term trend following strategies that ride the trend till it ends. Developing uncorrelated strategies is the first step towards building a diversified portfolio.

If you’re a mean reversion trader using the STC to detect overbought/oversold markets, it offers similar performance to ‘traditional’ indicators like the RSI and Stochastic.

You can download the above STC strategy in the Free Strategies section.

What do you think of the STC? Let me know in the comments!

Powered By

Development Platform

Forex VPS

FXVM Forex VPS

Popular Posts

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

read more

What is Fixed Ratio Money Management?

Have you heard of fixed ratio money management? How does it compare to the popular fixed fractional approach? Here I’ll explain how fixed ratio works, and see how it stacks up against fixed fractional money management.

read more

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

read more

What Is the QQE Indicator?

The QQE is a mysterious indicator that sometimes pops up in trading forums. Does it deserve a place alongside the more traditional momentum indicators like the RSI and CCI? Let’s add it to a trend following strategy to find out!

read more

Make your money work for you!

Get promotions, trading ideas and strategy development tips delivered to your inbox!

Comments

1 Comment

  1. Flibidi

    I’ll test it sooner or later. Thanks again for your great job! 🙂

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Trading Strategies

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

Forex Weekend Gaps: Can You Exploit Them?

Forex Weekend Gaps: Can You Exploit Them?

Have you noticed that forex weekend gaps usually reverse within 3 days? Here I’ll program a mean reversion strategy to exploit gaps over the last 18 years!

Money Flow Index: An Improved RSI?

Money Flow Index: An Improved RSI?

The Money Flow Index is sometimes called the volume-weighted RSI. Can it outperform the RSI in this trend following strategy?

Automated Bollinger Bands Squeeze Forex Strategy

Automated Bollinger Bands Squeeze Forex Strategy

StrategyQuant’s BBWR indicator is the perfect tool to detect a Bollinger Bands squeeze. Here I explain how it’s calculated, and use it to program a breakout strategy for the AUDJPY!

Should You Use the Kelly Criterion for Forex Trading?

Should You Use the Kelly Criterion for Forex Trading?

The Kelly criterion is a famous mathematical formula that attempts to maximize your long-term capital growth. In this post, I’ll apply it to a EURUSD breakout strategy and explain some of its potential shortcomings when applied to forex trading.

Can a Trading Pause Improve Your Trend Following Results?

Can a Trading Pause Improve Your Trend Following Results?

A temporary trading pause can improve your win rate if you’re trend following a volatile market. Here I’ll program a trading pause into a simple breakout strategy, and test its effectiveness on the Widow Maker – the GBPJPY.

Laguerre RSI Trend Following Strategy

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

How to Use the Supertrend Indicator

How to Use the Supertrend Indicator

Despite its cool name, the Supertrend indicator often seems to slip under the radar. Here I explain how it’s calculated, and combine it with moving averages to produce a simple trend following strategy.

Ichimoku Trend Following Strategy

Ichimoku Trend Following Strategy

Like candlesticks, the Ichimoku indicator is a fine Japanese creation. Here I’ll explain how the Ichimoku is plotted, and use it to build a trend following strategy for the USDJPY.

Strategy Development

Do You Know Your System Quality Number?

Do You Know Your System Quality Number?

The System Quality Number measures the profitability & consistency of your trading system. Here’s how to calculate your SQN and use it to improve your trading!

How to Get a Realistic Backtest Spread

How to Get a Realistic Backtest Spread

Your choice of backtest spread can certainly make or break a strategy. This post will show you how to study the intraday spread variations of your market, and suggest several ways to avoid paying ridiculous spreads.

Do You Know Your Strategy’s Optimization Profile?

Do You Know Your Strategy’s Optimization Profile?

Your strategy’s optimization profile often reveals its robustness, helping you select strategies that will remain profitable in live trading. Here I explain why an optimization profile is important, and how you can easily obtain one using StrategyQuant’s optimizer.

Which MT4 Backtest Report Metrics Should You Use?

Which MT4 Backtest Report Metrics Should You Use?

Understanding your backtest report is an essential part of being a successful strategy developer. Here I explain what the numbers mean, and how you can make use of each metric during strategy development.

Out-of-sample Testing Using Monte Carlo Simulations

Out-of-sample Testing Using Monte Carlo Simulations

Traders often use Monte Carlo simulations to estimate worst-case drawdowns, but did you know they can be used for out-of-sample testing too? This post demonstrates the use of StrategyQuant’s Monte Carlo simulator to randomize historical prices and strategy parameters, helping you select robust strategies for live trading.

How Many Trades Should Your Backtest Have?

How Many Trades Should Your Backtest Have?

We all want a large sample of trades in our backtests, but practical limitations such as data availability often get in the way. Here I’ll explain why 30 trades is insufficient, and how you can use standard error to quantify the uncertainty arising from a small sample size.

Build a Diversified Portfolio With QuantAnalyzer

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

Strategy Optimization Using MT4

Strategy Optimization Using MT4

How do you improve your trading strategy in MT4? This post will show you how to optimize the entry and exit parameters for a moving average crossover strategy. Finally, an intraday time filter will be added to help avoid false breakouts.

Debugging & Backtesting Using MT4

Debugging & Backtesting Using MT4

With a fresh algorithm at your fingertips, how do you verify that it has been programmed correctly? This guide will show you how to use Metatrader 4’s visual backtester to debug and backtest your strategy.

Create Your Trading Algorithm in 15 Minutes (FREE)

Create Your Trading Algorithm in 15 Minutes (FREE)

Converting your trading idea into an algorithm is the first step towards reaping the benefits of automated trading. This guide will cover the creation of a simple moving average crossover algorithm, without any actual programming.

What Is Drawdown in Trading?

What Is Drawdown in Trading?

Are you getting a comprehensive assessment of your strategy’s downside? This post will discuss several methods to measure drawdowns, helping you build and select strategies that better suit your risk appetite.

Live Trading

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

How to Find a Real Trading Guru

How to Find a Real Trading Guru

Every day I come across a trading guru offering educational content on the internet. Many of them speak of huge returns with minimal effort. Should these be trusted? Here’s some tips on how to separate the wheat from the chaff.

How to Enjoy Stress-Free Trading

How to Enjoy Stress-Free Trading

Trading is a great way to make some additional income, but not if you’re constantly pulling your hair out. Here I offer 7 tips to help make your trading profitable and stress-free.

How to Select the Best Forex VPS

How to Select the Best Forex VPS

A virtual private server (VPS) is a virtual computer that you can rent and access remotely. It provides a reliable platform on which to execute your forex strategies. This post will help you decide whether you need a VPS, and show you how to select an optimal VPS.

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Pin It on Pinterest

Share This