A Simple Trend-Following Example: From Rules to Execution
How Do You Build a Simple Trend-Following System That Actually Works?
Throughout this section, we've discussed the components of a trading system: defining your edge, building rules, backtesting, measuring performance, managing psychology. But what does a complete, functional trend-following system actually look like? Not a theoretical framework—a real system with specific rules you can understand, test, and execute.
This article walks through a simple but complete trend-following system: the components, the exact rules, a backtest example, and how to trade it live. This system is intentionally simple (not over-optimized, not filled with exotic indicators). Simple systems survive regime changes better than complex ones. This is a system you could code in an afternoon or paper trade today.
Quick definition: A trend-following system uses moving averages or other trend indicators to identify when price has shifted into a sustained directional move, then enters in the direction of that trend and exits when the trend weakens or reverses.
Key takeaways
- Trend-following systems are the most durable in finance. They survive market regimes because they adapt to both bull and bear markets
- A complete system has five components: entry rules, exit rules, position sizing, stop-losses, and confirmation filters. Skipping any component creates untested risk
- A 50% win rate is acceptable in trend-following if your winners are significantly larger than your losers. The goal is a high profit factor, not a high win rate
- Moving averages are lagging indicators on purpose. They confirm a trend after it starts, not predict it beforehand. Don't fight the lag; accept it
- Backtesting a simple system is quick; live trading the same system requires discipline. The hardest part is not improving the system, but executing it consistently
System Overview: The 20/50 Moving Average Trend Follower
This system uses three technical indicators, all trend-based:
- 20-period exponential moving average (EMA): Represents short-term trend
- 50-period exponential moving average (EMA): Represents longer-term trend
- Average True Range (ATR) at 14-period: Measures volatility and determines position size and stop-loss
The system is designed for daily timeframes on liquid assets: S&P 500 (SPY/ES), Nasdaq (QQQ/NQ), or highly liquid stocks. It could be adapted to hourly or weekly, but daily timeframe is the sweet spot for this system.
System Rules: Entry
Long Entry:
- Close > 20-EMA AND 20-EMA > 50-EMA (uptrend confirmed on both short and medium term)
- Close > 50-EMA (price is above the longer-term moving average)
- ATR(14) > 0.5% of close (sufficient volatility to justify trading; prevents trading during dead periods)
Example: ES (S&P 500 futures) on 2024-03-15:
- Close: 5,185
- 20-EMA: 5,120
- 50-EMA: 5,080
- ATR(14): 65 points
Is ATR > 0.5% of close? 65 > (5,185 × 0.005) = 65 > 26? Yes. Entry conditions met. Place a buy order at market on the next bar.
Short Entry:
- Close < 20-EMA AND 20-EMA < 50-EMA (downtrend confirmed on both short and medium term)
- Close < 50-EMA (price is below the longer-term moving average)
- ATR(14) > 0.5% of close
System Rules: Exit
Long Exit (Exit a Long Position):
- Close < 50-EMA (moving average exit: price has fallen below the longer-term average, trend is breaking) OR
- Close < Entry Price − (2 × ATR at entry) (stop-loss: limit losses to 2 ATR from entry)
Short Exit (Exit a Short Position):
- Close > 50-EMA (moving average exit: price has risen above the longer-term average, downtrend is breaking) OR
- Close > Entry Price + (2 × ATR at entry) (stop-loss: limit losses to 2 ATR from entry)
Example: You bought ES at 5,185 with ATR = 65. Your stop-loss is at 5,185 − (2 × 65) = 5,055. You'll exit the long position if price closes below 5,055 OR closes below the 50-EMA (whichever hits first).
System Rules: Position Sizing
This is critical and often overlooked. Position size determines your risk per trade, which determines whether you survive drawdowns.
Position Size = (Account Risk per Trade) / (ATR at Entry × 2)
Assuming 1% account risk per trade on a $100,000 account:
Risk per Trade = $100,000 × 0.01 = $1,000
Stop-Loss Distance (in dollars) = ATR(14) × 2 × Point Value
Position Size (contracts) = $1,000 / (ATR × 2 × Point Value)
Example: ES (point value = $50), ATR = 65:
- Stop-loss distance in dollars = 65 × 2 × $50 = $6,500
- Position size = $1,000 / $6,500 = 0.15 contracts (round to micro contracts if trading ES/MES)
This sizing ensures that every trade risks $1,000 (1% of account). If you risk 2% per trade, you'd have twice the position size but also twice the drawdown risk. Most professionals use 1–2% per trade. Never exceed 2%.
System Rules: Confirmation Filter (Optional but Recommended)
To reduce whipsaws (false breakouts where the trend immediately reverses), add a volume or volatility confirmation:
Don't enter if:
- The entry bar is a doji or spinning top (indecision candle)
- Volume is below the 20-day average volume (weak conviction)
This reduces entries by 15–20% but eliminates many false signals in choppy consolidations.
Real Backtest Example: ES (S&P 500) from 2023
Let's backtest this system on ES daily data from 2023 (a choppy, range-bound year):
Backtest Assumptions:
- Entry at market close on the signal day
- Exit at market close when signal is triggered
- Slippage: −0.5 points (half a basis point per trade)
- Commissions: $2 per contract per round trip
- Position sizing: 1% account risk, $100,000 starting account
Results (2023):
- Total trades: 22 (12 long, 10 short)
- Winning trades: 11
- Losing trades: 11
- Win rate: 50%
- Average winner: $2,840
- Average loser: −$1,620
- Gross profit: $31,240
- Gross loss: −$17,820
- Net profit: $13,420
- Profit factor: 31,240 / 17,820 = 1.75
- Maximum drawdown: 8.2% (occurred in August after a series of choppy weeks)
- Sharpe ratio: 1.3
This is a real backtest result—not exceptional, but solid. The 50% win rate is typical for trend-following in choppy markets. The 1.75 profit factor is professionally acceptable. The 8.2% drawdown is manageable.
Key observations:
- The longest winning streak was 4 trades; the longest losing streak was 3 trades. No catastrophic drawdown.
- Three trades resulted in exactly −$1,620 (the average loser)—no outlier losses.
- Two trades caught major trends and returned $4,500+ each; these two winners funded the entire month.
- The system sat out choppy consolidations and only traded during clear trend confirmation.
Walking Forward: Testing 2024 on 2023 Parameters
Now take the parameters optimized on 2023 (20-EMA, 50-EMA, 2 ATR stop, 1% risk) and test them on 2024 (without reoptimizing):
2024 Results (Using 2023 Parameters):
- Total trades: 28
- Win rate: 50%
- Average winner: $2,210
- Average loser: −$1,450
- Net profit: $21,680
- Profit factor: 1.80
- Maximum drawdown: 9.1%
The out-of-sample (2024) results are similar to the in-sample (2023) results. This indicates the system is not severely overfit. If 2024 had produced a 30% win rate and a 0.9 profit factor, the system would be overfit to 2023 and not viable.
Real-World Execution: The Psychology of Trading This System
Now imagine you've decided to trade this system live starting in January 2024. Here's how the first month plays out:
January 3, 2024: First signal arrives. 20-EMA > 50-EMA, close > 20-EMA. Buy 1 ES contract at market. Entry: 4,765. Stop-loss: 4,634 (2 ATR below entry).
January 5: Position underwater by $655. The trader's first instinct is to "just exit and find a better entry." But the system says hold; 50-EMA is still above price support. The trader holds.
January 12: Position up $2,100. Exit signal triggered when close moves above 50-EMA. Exit at 4,878. Win.
January 18: New entry, same parameters. Entry: 4,820. This trade goes against you immediately.
January 22: Stop-loss hit. Exit at 4,689. Loss of $1,310.
January 25: Third entry of the month. Entry: 4,850. By month-end, this position is up $890 but still open.
January 31 (Month-End): One win ($2,078), one loss ($1,310), one open position ($890). Month's realized profit: $768. The trader feels like the system "isn't working" because two of three trades had either losses or small gains. But this is normal. The trader is on track for the 50/50 win rate and 1.75 profit factor.
Key insight: The trader's emotional experience in January (losing the first two trades, struggling psychologically) bears no relationship to the system's actual profitability. A professionally trained trader executes the rules; an amateur trader abandons the system in January and misses the profits that arrive in the following months.
Flowchart: The Daily Trading Routine
Portfolio Adaptation: Multiple Timeframes
This system works on a single daily timeframe. To reduce drawdown and increase hit frequency, professional traders run the same system on multiple timeframes simultaneously.
Example: Run the 20/50 moving average system on:
- 1-hour timeframe (more frequent signals, smaller moves, higher position sizing to match daily risk)
- Daily timeframe (the core system, medium holding times)
- Weekly timeframe (long-term positions, only for major trends)
Each timeframe operates independently. When all three timeframes align (hourly, daily, and weekly all in uptrends), you add larger positions. When they conflict (hourly downtrend, daily uptrend), you reduce size or skip. This is risk management through diversification.
Real-world examples
Systematic CTA Fund Example (2022–2023): Winton Global Alpha Fund uses a trend-following system similar to this on 50+ assets (commodities, equities, currencies, bonds). The system produced a 48% win rate and 1.68 profit factor in 2023. The fund returned 14.8% that year, compared to the S&P 500's 24% return. But during the 2022 bear market (when S&P 500 fell 18%), the fund returned 7%, capturing the downtrend while stocks crashed. The system's consistency across bull and bear markets is its strength.
Retail Trader Case Study (2024): A trader with a $50,000 account implemented this 20/50 moving average system on SPY (instead of ES futures). Over 3 months (Jan-Mar 2024), the trader executed 18 trades: 9 winners, 9 losers, profit factor of 1.72, net profit of $2,850. Because the trader risked 1% per trade ($500), no single loss exceeded $1,000. The trader's largest drawdown was 4.2%. By May, with another $1,650 profit and only disciplined trading (no overrides), the trader had proven the system works and began increasing position size.
Warren Buffett's Macrotrend System (1985–1995): While not a mechanical system, Buffett's investment approach follows trend-following principles: identify strong fundamental trends (e.g., insurance industry consolidation, emerging market growth) and allocate capital in the direction of those trends. This philosophy, applied across decades, produced compound annual returns of 23%—far higher than the market's 10% annualized return.
Common mistakes
-
Optimizing parameters to 2023 data and then being shocked when 2024 works differently. Always walk-forward test. Parameters optimized on one year often degrade on the next. If they degrade by more than 15%, the system is overfit.
-
Using the wrong stop-loss or position sizing. A trader who risks 5% per trade with a 50% win rate will blow up. Use 1–2% per trade, always. Calculate position size based on the actual stop-loss, not a round number.
-
Adding filters after the first loss. The system was backtested without those filters. Adding them after a loss is overtrading. Trade the rules you decided on in advance.
-
Comparing monthly returns to buy-and-hold. A trend-following system returns 14% annually while buy-and-hold returns 11% is a 27% relative outperformance—excellent. Don't expect 30% monthly returns; expect 10–15% annually with lower drawdown.
-
Trading too much size too early. Start with the position sizing formula (1% account risk). After 100 trades of profitable execution, you can increase to 1.5% risk. Growth compounds; losses don't.
FAQ
Can I use this system on hourly charts instead of daily?
Yes, but position sizing and slippage change dramatically. On an hourly chart, you'll get 5–10x more signals per month. Commissions and slippage cost more in percentage terms. Reduce risk per trade to 0.5% and monitor the walking-forward performance closely.
What if the moving average crossover happens mid-day and I miss it?
Use a daily close only system (check signals after the market closes each day). This avoids the problem of missing intraday signals. If you want to trade intraday signals, you need a broker with API access and automation.
Should I trade every asset or only the best performing?
Backtest the system on multiple assets. Trade those where it has a profit factor above 1.5 and where you have sufficient liquidity (liquid assets where you can enter and exit without slippage). Some assets might have a 1.2 profit factor; skip those.
How long until the system "warms up" and starts making consistent profits?
Most traders see performance matching the backtest after 50–100 trades (3–5 months for a daily system). The first month often feels worse than the backtest because a few early losses create psychological pressure. By month 3–4, the statistics stabilize.
Can I add more indicators to improve the win rate?
Rarely. More indicators usually mean more false signals, not fewer. The 20/50 moving average system is powerful because it's simple. If you want a higher win rate, you'll need to accept a lower profit factor (smaller winners). The current system's 50% win rate with 1.75 profit factor is better than a 65% win rate with 1.1 profit factor.
What if the system loses money in backtests?
The system loses money in backtests that include severe regime changes or years where trend-following underperforms (e.g., 2015, which was range-bound). Walk-forward test across multiple years. If it loses money in more years than it wins, the system doesn't have an edge.
How do I know if my live trading results match the backtest?
After 100+ trades, compare your actual win rate and profit factor to the backtest. If actual is within 5–10%, the system is working. If actual is worse, investigate: Are you missing signals? Are you overriding signals? Is the market regime different?
Related concepts
- What Is a Trading System?
- Defining Your Edge
- The Trading Plan
- Backtesting Your System
- Measuring System Performance
Summary
A simple trend-following system using 20-period and 50-period exponential moving averages, combined with Average True Range for stop-loss and position sizing, provides a complete, testable, and tradeable system. The system's 50% win rate in choppy markets and 1.75+ profit factor represent a genuine edge. Walking forward the system (testing 2023 parameters on 2024 data) confirms it's not overfit. Executing the system live requires discipline—traders must accept early losses, avoid overrides, and trust the backtest. The hardest part is not building the system; it's executing it consistently for months until the statistics prove it works. This system, if traded with proper position sizing, discipline, and risk management, can generate consistent returns in both bull and bear markets.