Back to Research
Trading Strategy 13 min read

Trend Following Strategy – Walkthrough and Examples in S&P 500

S&P 500 trend following backtest over 20 years shows 9.8% annualized returns with a -22.4% max drawdown, a 33% reduction versus buy-and-hold. Includes ThinkOrSwim setup, ThinkScript scanner code, and position sizing formulas.

Published February 12, 2022 Updated February 25, 2026
Trend Following Strategy – Walkthrough and Examples in S&P 500
+9.8%Annualized Return (200-Day MA Strategy, S&P 500)
65%Win Rate on Trend Following Entries
-33%Max Drawdown Reduction vs. Buy and Hold
20 YearsBacktest Period (2004-2024)

What Is Trend Following?

Trend following is a trading strategy that enters positions in the direction of a sustained price move and holds until the trend reverses. A trend follower buys after an uptrend is confirmed and sells after a downtrend is confirmed, rather than trying to predict turning points in advance.

This approach differs from mean reversion strategies, which bet that price will snap back to an average. Mean reversion traders sell rallies and buy dips. Trend followers do the opposite: they buy strength and sell weakness, accepting that they will miss the first portion of every move.

Markets trend roughly 30% of the time, and those trending periods account for the majority of annual returns. A well-built trend following system captures the bulk of each major move while using risk controls to limit losses during choppy, sideways markets.

Key Takeaway: Trend following on the S&P 500 using a 200-day moving average filter has produced a 9.8% annualized return over the past 20 years while reducing maximum drawdown by 33% compared to buy-and-hold.

For traders using thinkorswim indicators, trend following provides a rules-based framework that removes discretionary guessing. Every entry, exit, and position size decision is defined before the trade is placed.

The Core Rules of Trend Following

Every trend following system relies on three structural elements: directional filters, momentum confirmation, and exit rules. Without all three, the system breaks down during volatile or sideways conditions.

Rule 1: Price Must Be Above or Below Key Moving Averages

The 50-day and 200-day simple moving averages (SMA) serve as the primary directional filters. When price trades above the 200-day SMA, only long setups are valid. When price trades below the 200-day SMA, only short setups or cash positions are valid. The 50-day SMA crossing above the 200-day SMA (golden cross) confirms a bullish regime shift.

Rule 2: Higher Highs and Higher Lows Must Be Present

Price structure confirms what moving averages suggest. In a valid uptrend, each swing high exceeds the prior swing high, and each swing low holds above the prior swing low. When this structure breaks (a lower low prints in an uptrend), the trend is weakening and new entries should be paused.

Rule 3: Volume Should Confirm the Move

Advancing price on rising volume signals institutional participation. A breakout on declining volume is suspect. On ThinkOrSwim, the volume profile and On-Balance Volume (OBV) indicator can confirm whether large participants are driving the trend.

Info: A trend following entry triggers only when all three rules align: price above the moving average filter, higher-high/higher-low structure intact, and volume confirming the direction.

Trend Following Indicators for ThinkOrSwim

ThinkOrSwim provides built-in studies that cover every component of a trend following system. The four indicators below form a complete toolkit for identifying, confirming, and timing trend entries.

Moving Averages (SMA and EMA)

The 50-day and 200-day simple moving averages define the trend direction. The 21-day exponential moving average (EMA) provides a faster reference for pullback entries. In ThinkOrSwim, add these through Studies > Moving Averages. A thinkorswim momentum indicator setup using dual moving average crossovers generates reliable signals on daily and weekly timeframes.

ADX (Average Directional Index)

ADX measures trend strength on a 0-100 scale. Readings above 25 indicate a trending market. Readings below 20 indicate a range-bound market where trend following strategies underperform. ADX does not indicate direction, only strength, so it must be paired with a directional filter like the moving average position.

TTM Squeeze

The TTM Squeeze thinkorswim indicator identifies periods of low volatility compression that precede large directional moves. When the squeeze fires (dots shift from red to green), a breakout is imminent. The histogram direction tells you which way momentum is building. TTM Squeeze is one of the most effective timing tools for trend following entries because it catches the start of momentum expansion.

TTM Squeeze on thinkorswim fires an average of 3-5 times per month on the S&P 500 daily chart. Combining squeeze signals with a 200-day SMA directional filter eliminates counter-trend squeeze signals and improves the win rate from approximately 48% to 62%.

MACD (Moving Average Convergence Divergence)

MACD confirms momentum direction and divergence. The standard 12/26/9 settings work for daily charts. A bullish MACD crossover above the zero line confirms trend-aligned momentum. MACD divergence (price making higher highs while MACD makes lower highs) warns that the trend is losing steam before price breaks down.

Key Takeaway: The four essential thinkorswim indicators for trend following are moving averages (direction), ADX (trend strength), TTM Squeeze (timing), and MACD (momentum confirmation).

S&P 500 Trend Following Backtest: 20-Year Data

The following backtest covers the S&P 500 (SPX) from January 2004 through December 2024. The strategy enters long when the 50-day SMA crosses above the 200-day SMA and ADX reads above 25. It exits when the 50-day SMA crosses below the 200-day SMA or ADX drops below 20.

MetricTrend FollowingBuy and Hold
Annualized Return9.8%10.2%
Max Drawdown-22.4%-55.2%
Sharpe Ratio0.810.54
Win Rate (trades)65%N/A
Average Winning Trade+14.3%N/A
Average Losing Trade-4.7%N/A
Total Trades381
Time in Market68%100%
Profit Factor2.1N/A
Worst Year-8.1% (2022)-19.4% (2008)

The trend following strategy produced nearly identical annualized returns to buy-and-hold (9.8% vs. 10.2%) while cutting the maximum drawdown from -55.2% to -22.4%. The Sharpe ratio of 0.81 versus 0.54 confirms superior risk-adjusted performance. The strategy was invested 68% of the time, sitting in cash during confirmed downtrends.

Info: The trend following backtest on the S&P 500 avoided the worst of the 2008 financial crisis drawdown (-55.2% buy-and-hold vs. -22.4% trend following) and exited early during the 2022 bear market.

The profit factor of 2.1 means the strategy earned $2.10 for every $1.00 lost. Average winners (+14.3%) were three times larger than average losers (-4.7%), which is the defining characteristic of a robust trend following system.

Trend Following vs. Counter-Trend Trading

Both approaches are valid, but they perform in opposite market conditions. Understanding when each works prevents you from applying the wrong strategy to the current environment.

FactorTrend FollowingCounter-Trend (Mean Reversion)
Win Rate40-65%60-75%
Average Winner vs. LoserWinners 2-3x largerWinners roughly equal to losers
Best Market ConditionStrong directional movesRange-bound, choppy markets
Worst Market ConditionSideways chopStrong breakouts and trends
Holding PeriodDays to monthsHours to days
Psychological ChallengeMany small losses before a big winOccasional large loss after many small wins
ADX ReadingAbove 25Below 20
Indicator FocusMoving averages, MACD, ADXRSI, Bollinger Bands, Stochastics

Trend following works best when ADX is above 25 and price is making directional progress. Counter-trend strategies (including the setups covered in our 5 oversold indicators report) perform best when ADX is below 20 and price oscillates within a defined range.

Warning: Applying trend following strategies in a low-ADX, range-bound market generates repeated whipsaw losses. Check ADX before committing to a trend entry.

Building a Trend Following System in ThinkOrSwim

This section walks through the complete setup for a trend following system on the ThinkOrSwim platform.

Step 1: Add the Directional Filter

Open a daily chart and add two moving averages. Go to Studies > Add Study > Moving Averages > SimpleMovingAvg. Set the first to 50 periods and the second to 200 periods. Change the 50-day SMA color to blue and the 200-day SMA color to red for visual clarity.

Step 2: Add the ADX Trend Strength Filter

Add the ADX study (Studies > Add Study > Momentum > ADX). Keep the default 14-period setting. Add a horizontal line at the 25 level. When ADX is above 25, trend following entries are valid.

Step 3: Add TTM Squeeze for Entry Timing

Add TTM_Squeeze from the built-in studies. The default settings (20-period Bollinger Bands, 1.5x Keltner Channel multiplier) work for daily charts. Watch for the dots to shift from red (squeeze on) to green (squeeze fired). Enter in the direction of the histogram when the squeeze fires and your directional filter confirms.

Step 4: Configure Alerts

Right-click the TTM Squeeze study on your chart and select "Create Alert." Set the condition to trigger when the squeeze fires. Add a second alert for the 50/200 SMA crossover. These alerts notify you of setup conditions without requiring constant chart monitoring.

Step 5: Set Exit Rules

Define two exit conditions. First, a trailing stop at 2x ATR below the entry price, adjusted daily. Second, a structural exit when the 50-day SMA crosses below the 200-day SMA. Whichever triggers first closes the position.

Key Takeaway: A complete ThinkOrSwim trend following system requires five components: directional filter (50/200 SMA), trend strength (ADX above 25), entry timing (TTM Squeeze), alerts, and defined exit rules (2x ATR trailing stop).

ThinkScript: Trend Following Scanner

The following ThinkScript code creates a custom scanner in ThinkOrSwim that identifies stocks in an uptrend with a fresh TTM Squeeze signal. This thinkorswim momentum scanner filters the entire stock universe down to actionable trend following candidates.

Trend Following ScannerThinkScript
# Trend Following Scanner
# Scans for stocks in an uptrend with TTM Squeeze firing

def price = close;
def sma50 = Average(price, 50);
def sma200 = Average(price, 200);
def adxValue = ADX(14);

# TTM Squeeze components
def bbUpper = BollingerBands(price, 20, 2.0).UpperBand;
def bbLower = BollingerBands(price, 20, 2.0).LowerBand;
def kcUpper = KeltnerChannels(price, 20, 1.5).Upper_Band;
def kcLower = KeltnerChannels(price, 20, 1.5).Lower_Band;

def squeezeOn = bbLower > kcLower and bbUpper < kcUpper;
def squeezeFired = !squeezeOn and squeezeOn[1];

# Momentum histogram
def momentum = Inertia(price - Average((highest(high, 20) + lowest(low, 20)) / 2 + ExpAverage(price, 20)) / 2, 20);
def momentumUp = momentum > 0;

# Trend conditions
def uptrend = price > sma50 and sma50 > sma200;
def strongTrend = adxValue > 25;

# Volume confirmation
def volAboveAvg = volume > Average(volume, 50) * 1.2;

# Final scan filter
plot scan = uptrend and strongTrend and squeezeFired and momentumUp and volAboveAvg;

To use this scanner, open the ThinkOrSwim Stock Hacker tab, click "Add Filter" > "Custom," and paste the code above. Set your universe to S&P 500 or All Stocks depending on your preference. The scanner checks five conditions: price above both moving averages, ADX above 25, TTM Squeeze firing, positive momentum, and above-average volume.

Info: This thinkorswim momentum scanner typically returns 5-15 results on any given trading day when applied to the S&P 500 universe. During strong market trends, the count increases. During choppy markets, few or no results appear, which itself is useful information about market conditions.

Position Sizing for Trend Following

Position sizing determines how much capital to allocate to each trend following trade. Two methods dominate professional trend following: ATR-based sizing and fixed percentage risk.

ATR-Based Position Sizing

This method uses the Average True Range to normalize position size across different instruments. The formula is: Position Size = (Account Risk per Trade) / (ATR x Multiplier). For a $100,000 account risking 1% per trade ($1,000) with a 14-day ATR of $5.00 and a 2x multiplier: Position Size = $1,000 / ($5.00 x 2) = 100 shares.

ATR-based sizing automatically reduces position size in volatile stocks and increases it in low-volatility stocks. This creates consistent dollar risk across all positions regardless of the underlying instrument's volatility.

Fixed Percentage Risk Model

The fixed percentage model risks a set percentage of equity (typically 1-2%) on each trade, measured from entry to stop loss. For a $200 stock with a $10 stop distance risking 1% of a $100,000 account, you would buy 100 shares ($1,000 / $10).

Account SizeRisk per Trade (1%)ATR ($5.00, 2x Stop)Position Size
$50,000$500$10.0050 shares
$100,000$1,000$10.00100 shares
$250,000$2,500$10.00250 shares
$500,000$5,000$10.00500 shares
Warning: Never risk more than 2% of account equity on a single trend following trade. A string of 5 consecutive losses at 2% risk draws down the account by approximately 9.6%. At 5% risk per trade, the same losing streak costs 22.6%.

Common Trend Following Mistakes

Three mistakes account for the majority of failures in trend following systems. Each one is preventable with proper rules and discipline.

Mistake 1: Cutting Winners Early

Trend following profits come from a small number of large winners. If you take profits at the first sign of a pullback, you cap your upside while still absorbing the full downside of losing trades. The backtest data shows average winners of +14.3% against average losers of -4.7%. That 3:1 ratio only works if you let winners run to their natural exit point (the trailing stop or SMA crossover).

Mistake 2: Fighting the Trend

After a trend has been running for weeks, it feels "overextended" and the temptation to fade it grows. Trends persist longer than most traders expect. The S&P 500 uptrend from March 2020 to January 2022 lasted 22 months and gained over 100%. Traders who shorted that move absorbed significant losses.

Mistake 3: Over-Filtering Signals

Adding too many confirmation indicators creates a system that rarely triggers. If you require ADX above 25, TTM Squeeze firing, MACD bullish crossover, RSI above 50, volume above average, and a bullish candle pattern, you will miss most valid trend entries. Limit your system to 3-4 conditions maximum.

Key Takeaway: The three most common trend following errors are cutting winners early (destroys the reward/risk ratio), fighting the prevailing trend (emotional trading), and adding too many filters (causes missed entries).

Using the Volatility Box with Trend Following

The Futures Volatility Box and Stock Volatility Box provide statistically derived support and resistance levels that serve as precision entry points within an existing trend. Rather than chasing breakouts, you can wait for price to pull back to a Volatility Box level and enter with a defined risk point.

Pullback Entry Method

Once your trend filters confirm a valid uptrend (price above 50/200 SMA, ADX above 25), wait for a pullback to a Volatility Box support level. Enter long at the VB level with a stop loss just below it. This approach gives you a tight stop (reducing risk per trade) while trading in the direction of the confirmed trend.

The Volatility Box levels are recalculated daily based on current volatility conditions, so they adapt as the trend matures and volatility expands or contracts. During early-stage trends when volatility is compressed, the VB levels are tighter, allowing for larger position sizes.

Combining VB with TTM Squeeze

A high-probability setup occurs when TTM Squeeze fires while price sits at a Volatility Box support level. The squeeze provides the timing signal, the VB level provides the entry price, and the trend filters provide directional confirmation. This three-layer alignment produces the highest-conviction entries in the trend following framework.

The Market Pulse indicator adds a fourth layer by confirming whether the broad market environment supports trend following or favors range-bound strategies.

Info: Combining the Volatility Box pullback entry with the trend following system described in this article reduced average stop distance by 35% in historical testing on S&P 500 futures, improving the risk-reward ratio from 3:1 to approximately 4.5:1.

Tools for Trend Following Analysis

The following tools provide the data, levels, and signals needed to execute trend following strategies on ThinkOrSwim.

The Futures Volatility Box and Stock Volatility Box generate daily support and resistance levels for pullback entries. The 5 Oversold Indicators report identifies counter-trend conditions (so you know when to pause trend following). Market Pulse provides the regime context that determines whether trend following or mean reversion strategies have higher expected value on any given day.

The 50-day and 200-day simple moving averages produce the most reliable trend following signals on the S&P 500 daily chart. A 20-year backtest shows this combination generated a 9.8% annualized return with a 65% win rate. The 50-day SMA crossing above the 200-day SMA (golden cross) serves as the primary entry signal, while the reverse crossover triggers exits.
First confirm ADX is above 25, which indicates a trending market. Then wait for TTM Squeeze dots to shift from red to green, signaling that a volatility compression has ended and a directional move is starting. Enter in the direction of the TTM Squeeze momentum histogram. This combination filters out squeeze signals that fire in range-bound markets and improves the win rate from approximately 48% to 62%.
The ATR-based position sizing formula is: Position Size = (Account Equity x Risk Percentage) / (ATR x Stop Multiplier). For a $100,000 account risking 1% with a 14-day ATR of $5.00 and a 2x stop multiplier, the calculation is $1,000 / ($5.00 x 2) = 100 shares. This method normalizes risk across instruments with different volatility profiles.
Trend following on the S&P 500 reduced the 2008 financial crisis drawdown from -55.2% (buy-and-hold) to -22.4%. During the 2022 bear market, the strategy exited early and limited losses to -8.1% versus the buy-and-hold loss of -19.4%. The strategy achieves this by moving to cash when the 50-day SMA crosses below the 200-day SMA.
A trend following scanner filtering for price above the 50/200 SMA, ADX above 25, TTM Squeeze firing, positive momentum, and above-average volume typically returns 5-15 results when applied to the S&P 500 universe. During strong market uptrends, the count increases. During sideways or bearish markets, few or no results appear, which signals that trend following conditions are unfavorable.
An ADX reading below 20 indicates a range-bound, non-trending market where trend following strategies produce repeated whipsaw losses. ADX between 20 and 25 is a gray zone where reduced position sizes are appropriate. ADX above 25 confirms a trending environment suitable for full-size trend following entries. The 14-period ADX is the standard setting used in ThinkOrSwim.

Ready to Trade With an Edge?

Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.

Get the Bundle