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!

Want to develop a portfolio of automated trading strategies?

Supercharge your strategy development with StrategyQuant

Access 14-day FREE trial here!

Get up to USD 300 discount!

Strategies need improvement?

Use QuantAnalyzer’s powerful analysis tools

Try the FREE version here!

Get 20% Discount here!

FXVM Forex VPS
Follow Us

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

Hey there, Wayne here! I’m on a mission to develop robust algorithmic trading strategies for the forex markets. Trading Tact is where I share my trading methods and insights.

Follow Us
Have a Question?

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 *

Want to develop a portfolio of automated trading strategies?

Supercharge your strategy development with StrategyQuant

Access 14-day FREE trial here!

Get up to USD 300 discount!

Strategies need improvement?

Use QuantAnalyzer’s powerful analysis tools

Try the FREE version here!

Get 20% Discount here!

FXVM Forex VPS

Recent Posts

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.

read more

Hey there, Wayne here! I’m on a mission to develop robust algorithmic trading strategies for the forex markets. Trading Tact is where I share my trading methods and insights.

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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!

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