Featured

The Turtle Trading Rules Decoded: From Legendary Stories to Modern Python Practice, Building Your Systematic Trend Engine.

量化研究團隊
2025-12-15 14 min read EN
The Turtle Trading Rules Decoded: From Legendary Stories to Modern Python Practice, Building Your Systematic Trend Engine.

Foreword: Ten thousand dollars and a legendary bet

In 1983, two titans of the commodities trading world—Richard Dennis and William Eckhardt—engaged in a fundamental debate: are great traders born or made? Dennis believed they could be trained through a systematic set of rules, while Eckhardt was skeptical. To settle the debate, they placed an advertisement in the Wall Street Journal, recruiting and training a group of students from various backgrounds with virtually no trading experience. These students later became known as the "Turtle Traders."

Dennis taught them a complete trend-following trading system. The core of this system was not to predict the market, but rather to get on board when a trend forms and exit when the trend reverses, through rigorous risk control and position management. The results were stunning: over the next four years, these "turtles" generated more than $100 million in profits for Dennis, with some of the most successful students achieving compound annual returns exceeding 80%. This story not only became a legend in trading circles, but also established systematic, quantitative trend-following as a viable investment philosophy.

However, common understanding of the Turtle Trading Rules often stops at the simple mantra of "buy on a 20-day breakout, sell on a 10-day breakout." This is like seeing only the tip of an iceberg. This article will serve as your quantitative scalpel, diving beneath the surface to explore the true essence: position sizing calculations based on volatility adjustment (N-value calculations), capital management, and more, while building a complete backtesting framework in Python. We will examine its performance in extreme markets and discuss how to improve and adapt this classic system in today's high-frequency, algorithm-driven market environment.

The Four Core Pillars of the Turtle Trading System: Beyond Breakout Signals

The true Turtle System is a complete ecosystem containing four tightly connected modules: entry, pyramiding, stop-loss, and exit, all permeated by strict money management discipline.

1. Entry Strategy: Dual System Architecture

The Turtles were taught to use two independent entry systems to capture trends at different time scales.

  • System One (Short-Term System): Based on 20-day breakouts. Go long when price breaks above the highest price over the past 20 trading days; close longs or go short when price breaks below the lowest price over the past 10 trading days (for shorts, rules are symmetric).
  • System Two (Long-Term System): Based on a 55-day breakout. Use the 55-day breakout as an entry signal and the 20-day breakout as a filter (to avoid frequent entries and exits during volatility). This aims to capture grander, more persistent trends.

Two systems running simultaneously without interference. This itself embodies the idea of diversification—not placing all bets on a single parameter.

2. Pyramid Position Addition: Increasing Risk Exposure in Profit

This is the most counterintuitive yet most critical step in the Turtle system. Most retail traders average down during losses, while Turtles add positions during profits. The rule is as follows: after the initial position is established, every time the price moves 0.5 units of "N" in the favorable direction (N is the key unit measuring market volatility, explained in detail below), add one unit of position, with a maximum of 3 additions (a total of 4 units). This method of "adding on profit," concentrates positions in the correct direction when the trend truly develops, maximizing trend gains.

3. Hard stops: the first iron law of survival

The Turtle Trading Rules place capital preservation at the highest priority. The risk of each trade is strictly limited to within 2% of total capital. Specifically, the stop-loss point for any single position is set at 2 "N" units from the entry price. For example, when going long, the stop-loss price = entry price - 2 × N. Since position size is calculated based on N (see the following section), this ensures that even if price touches the stop-loss, the loss of total capital will not exceed 2%. This is a mechanical discipline that brooks no argument.

4. Exit Strategy: Let Profits Run, But Don't Let Them Slip Away

Exit is as systematic as entry. For System One longs, the exit signal is the breach of the 10-day low; for System Two, the 20-day low. Note that the exit signal is different from the shorting entry signal, which emphasizes the system's independence. Exit rules force traders to cut losses and allow profits to run as long as possible before trend reversal is confirmed.

The Heart of the Strategy: Position Sizing Calculation Centered on "N"

This is the core essence of quantitative Turtle system discipline, and the biggest difference from ordinary technical analysis. N, the "Average True Range" (ATR), is a standardized unit for measuring market volatility.

True Range (TR)calculation formula is:TR = max(當日最高價 - 當日最低價, |當日最高價 - 前日收盤價|, |當日最低價 - 前日收盤價|) Then, Perform a 20-Day Simple Moving Average on TR (Corresponding to the System) to Obtain N Value.

Position sizing calculation formulaThe magic formula of the Turtle system. It ensures that regardless of whether the traded asset is volatile crude oil or stable government bonds, each trade carries the same initial risk exposure.頭寸規模單位(以合約數或股數計) = (賬戶總風險的1% / (N * 每點價值))\n Among them, "1% of total account risk" refers to the absolute dollar risk you are willing to bear for that position. Turtles actually used 2% as the maximum risk for a single position, but constructed in 1% units for easier position building management.

Example: Assuming an account size of $100,000, a certain commodity futures contract has an N value of 0.250, and each point is worth $100.\nThen the position size per unit = ($100,000 * 1%) / (0.250 * 100) = $1,000 / 25 = 40 contracts.\nThis means that if the position hits a stop loss at 2N, the loss will be exactly $1,000 * 2 = $2,000, representing 2% of total capital.

This approach achievedVolatility-Adjusted Position Sizing: When market volatility is high (high N values), automatically reduce positions; when market is calm (low N values), increase positions. This is a built-in risk parity mechanism.

Python Practical Application: Building a Turtle Trading System Backtesting Engine

Below we use Python's `pandas` and `backtrader` framework (a commonly used backtesting library) to construct the core logic of the Turtle system. This section emphasizes code for N-value calculation and position sizing management.

import pandas as pd
import numpy as np
import yfinance as yf
import backtrader as bt

class TurtleStrategy(bt.Strategy):
    params = (
        ('system1_entry', 20),  # 系統一入市周期
        ('system1_exit', 10),   # 系統一退出周期
        ('system2_entry', 55),  # 系統二入市周期
        ('system2_exit', 20),   # 系統二退出周期
        ('atr_period', 20),     # N值計算周期
        ('risk_per_trade', 0.02), # 每筆交易最大風險(2%)
        ('unit_risk', 0.01),    # 每個單位風險(1%)
        ('pyramid_factor', 0.5), # 加倉間隔(0.5N)
    )

    def __init__(self):
        # 計算價格高低通道
        self.high_s1 = bt.indicators.Highest(self.data.high, period=self.p.system1_entry)
        self.low_s1 = bt.indicators.Lowest(self.data.low, period=self.p.system1_exit)
        self.high_s2 = bt.indicators.Highest(self.data.high, period=self.p.system2_entry)
        self.low_s2 = bt.indicators.Lowest(self.data.low, period=self.p.system2_exit)

        # 計算真實波動幅度均值(N)
        self.atr = bt.indicators.ATR(self.data, period=self.p.atr_period)

        # 跟蹤變量
        self.unit_size = 0  # 每個單位的頭寸規模(股數)
        self.position_units = 0  # 當前持有的單位數
        self.entry_price = 0.0  # 初始入市均價
        self.last_pyramid_price = 0.0  # 上次加倉價格

    def next(self):
        # 計算當前每個單位的頭寸規模(簡化版:假設每點價值為1美元/股)
        account_value = self.broker.getvalue()
        risk_per_unit = account_value * self.p.unit_risk  # 每個單位允許風險的美元值
        # N值以價格點數表示,所以每點價值為1。實際期貨需調整。
        self.unit_size = int(risk_per_unit / self.atr[0]) if self.atr[0] != 0 else 0

        # 如果沒有持倉,尋找入市信號
        if not self.position:
            self.position_units = 0
            # 系統一入市:突破20日高點
            if self.data.close[0] > self.high_s1[-1]:
                self.entry_price = self.data.close[0]
                self.last_pyramid_price = self.entry_price
                self.order = self.buy(size=self.unit_size)
                self.position_units = 1
                print(f'{self.data.datetime.date(0)}: 系統一入市做多 @ {self.entry_price:.2f}, 單位數={self.position_units}, N={self.atr[0]:.3f}')
            # 系統二入市:突破55日高點,且價格高於20日高點(過濾)
            elif self.data.close[0] > self.high_s2[-1] and self.data.close[0] > self.high_s1[-1]:
                self.entry_price = self.data.close[0]
                self.last_pyramid_price = self.entry_price
                self.order = self.buy(size=self.unit_size)
                self.position_units = 1
                print(f'{self.data.datetime.date(0)}: 系統二入市做多 @ {self.entry_price:.2f}, 單位數={self.position_units}')

        # 如果已有持倉,檢查加倉、止損和退出
        else:
            current_price = self.data.close[0]
            # 金字塔加倉:持倉不超過4個單位,且價格上漲了0.5N
            if self.position_units < 4 and current_price >= self.last_pyramid_price + self.p.pyramid_factor * self.atr[0]:
                self.order = self.buy(size=self.unit_size)
                self.position_units += 1
                self.last_pyramid_price = current_price
                print(f'{self.data.datetime.date(0)}: 金字塔加倉,單位數={self.position_units} @ {current_price:.2f}')

            # 硬性止損:價格跌破入市價 - 2N
            stop_loss_price = self.entry_price - 2 * self.atr[0]
            if current_price <= stop_loss_price:
                self.order = self.sell(size=self.position.size)
                print(f'{self.data.datetime.date(0)}: 觸發2N止損 @ {current_price:.2f}')

            # 系統一退出:跌破10日低點
            if self.position_units > 0 and current_price < self.low_s1[-1]:
                self.order = self.sell(size=self.position.size)
                print(f'{self.data.datetime.date(0)}: 系統一退出 @ {current_price:.2f}')

            # 系統二退出(僅對系統二頭寸,此處簡化處理):跌破20日低點
            # 實戰中需區分頭寸來自哪個系統,此為示例。

# 下載數據並運行回測
if __name__ == '__main__':
    cerebro = bt.Cerebro()
    cerebro.addstrategy(TurtleStrategy)

    # 以SPY(標普500 ETF)為例
    data = bt.feeds.PandasData(dataname=yf.download('SPY', '2010-01-01', '2023-12-31', auto_adjust=True))
    cerebro.adddata(data)

    cerebro.broker.setcash(100000.0)
    cerebro.broker.setcommission(commission=0.001)  # 0.1%佣金

    print('起始資金: %.2f' % cerebro.broker.getvalue())
    cerebro.run()
    print('最終資金: %.2f' % cerebro.broker.getvalue())
    cerebro.plot()

Note: The above code is a simplified version that demonstrates core logic. In actual trading, consideration must be given to transaction costs, slippage, futures contract rolling, multi-asset portfolios, and strict separation of signal generation and position management systems.

Historical Case Examination: Glory and Scars

Any strategy must undergo stress testing against extreme markets. We analyze two key periods:

Case Study One: 2008 Global Financial Crisis—The "Shining Moment" of Trend-Following

From the latter half of 2007 to 2008, stock markets and commodity markets exhibited clear one-sided downtrends. A strictly executed Turtle system that includes short mechanisms would establish short positions around October 2007 (breaking the 55-week moving average or key support) and amplify positions through pyramiding during the decline. Subsequently, when the market bottomed and rebounded in March 2009, breaking through the short-term declining trendline, the system would trigger stop-losses on shorts or reverse to long signals. According to many hedge fund performance reports, pure trend-following strategies (such as AQR's Time Series Momentum) achieved significant positive returns (+10% to +30% range) in 2008, creating a stark contrast to equity market losses and perfectly demonstrating their "crisis alpha" attribute.

Case Two: March 2020 COVID-19 Pandemic Crash—The Double-Edged Sword of Violent Volatility

From February to March 2020, markets experienced a flash crash and violent rebound. This posed a stern test for the Turtle system. The system might have gone short when breaking key support at the end of February, but the market's V-shaped reversal in late March might simultaneously trigger stop-losses on shorts (due to rapid rebounds) and entry signals for longs (breaking recent highs). If volatility (N value) surged sharply, the system would quickly reduce position sizes, but violent price whipsaws could result in "double stops" (whipsaws on both sides), causing multiple small losses. This reveals the greatest weakness of classical trend-following in trendless, high-volatility choppy markets: drawdowns. According to some public data, many trend-following funds experienced significant drawdowns of 5%-15% in the first quarter of 2020.

These two cases illustrate that the Turtle strategy is not a "holy grail." It excels in strong trending markets but suffers painful drawdowns in choppy markets. The key to its long-term profitability lies in maintaining discipline, using profits from several major trends to cover multiple small losses.

Challenges and Improvement Approaches in Modern Markets

Today's markets are worlds apart from the 1980s. High-frequency trading, algorithm dominance, and rapid information dissemination lead to increased short-term noise and possibly shorter trend persistence. Directly copying the original Turtle Rules faces challenges.

  • Challenge 1: Increased false breakouts。The 20-day Breakout Is Frequently Tested in Algorithmic Trading. Consider AddingVolatility FilteringorVolume ConfirmationFor example, requiring that the breakthrough day's true range or trading volume exceeds recent average levels to confirm breakthrough validity.
  • Challenge 2: Asset Correlation Changes. Turtles originally applied to low-correlation commodity markets. Today, asset correlations spike during crises, weakening diversification. Need more refinedPortfolio-level risk management, monitoring overall risk exposure.
  • Improvement Idea 1: Dynamic Exit. Original version uses fixed-period breakout exit. Can be modified toMoving stop loss, for example, after a position, move the stop-loss up to 1.5N or 2N below the recent low, more flexibly protecting profits.
  • Improvement Approach 2: Multi-Timeframe FusionNot only look at daily charts, but can add weekly trends as a filter. For example, only execute daily-level trades when weekly and daily signals point in the same direction, to improve win rate (but may reduce timeliness in capturing trends).
  • Improvement Approach 3: Machine Learning AssistanceYou can use simple machine learning models (such as logistic regression, random forests) to classify breakout signals and judge their success probability. Features can include volatility at the time of breakout, market breadth, macroeconomic sentiment indicators, etc. This is not to replace rules, but to serve as an additional filter layer.

Action Recommendations: How to Start Your Systematic Trend Following Journey

  1. Paper trading phase (1-3 months)Thoroughly read original materials. Essential classics: Curtis Faith (one of the most successful Turtles), "The Complete TurtleTrader." Strictly execute the original rules in a simulation account, recording every trade's signal, position sizing, profit/loss, and emotional state.
  2. Quantitative Backtest PeriodUsing the Python code framework provided in this article, conduct at least 20 years of historical backtests on multiple assets (stock index ETFs, commodity ETFs, currency pairs). Focus on observing: maximum drawdown, Sharpe ratio, profit factor (total profit/total loss), and the number of consecutive losing trades. Ask yourself: can you tolerate such drawdowns in the capital curve?
  3. Small Live Trading Trial Period (at least one year): Use a small amount of capital you can completely afford to lose (such as 5-10% of total investment capital) for live operations. The key is100% Mechanical Execution, overcoming subjective intervention like "this signal doesn't look good, I won't do it." This year is key to honing your psychological discipline.
  4. Iteration and Optimization Period: On the basis of live trading experience, make targeted improvements (such as the aforementioned filters). Remember: only change one parameter at a time, and strictly test its effect with out-of-sample data. Avoid overfitting.
  5. portfolio and execution periodIntegrate this strategy as part of your entire investment portfolio, not its entirety. It can be combined with low-correlation strategies such as value investing and arbitrage, smoothing the overall return curve. Consider using professional quantitative platforms or broker APIs to implement automated trading, eliminating emotional interference.

Risk Alert and Disclaimers

Important Risk Reminder:

  • Significant Drawdown Risk: Trend-following strategies experience significant drawdowns (historically up to 30%-50%) possibly lasting months or even years during trendless or highly choppy markets. This is a severe test on investor psychology and capital persistence.
  • strategy failure riskMarket structure is changing. Any strategy that was historically profitable may fail in the future. The profitability basis of the Turtle Rules is the existence of persistent trends in markets. If fundamental changes occur in market characteristics (such as central banks' long-term intervention to suppress volatility), the strategy may be unprofitable over the long term.
  • Execution RiskSlippage, insufficient liquidity, inability to execute in extreme conditions all can severely erode theoretical returns. Futures trading involves leverage, potentially creating losses exceeding principal.
  • Psychological RiskThe greatest enemy of systematic trading is yourself. Abandoning execution after consecutive losses, or over-confidence after huge profits leading to rule changes, are the most common reasons for failure.

disclaimer: All content in this article is provided solely for educational and informational purposes and does not constitute any form of personalized financial guidance, financial advisory opinion, or trading invitation. Historical performance mentioned in the article does not represent future results. Financial trading carries high risks and may result in total loss of principal. Before making any investment decision, readers should consult with independent professional financial advisors based on their own financial circumstances, risk tolerance, and investment objectives. The author and publishing platform assume no responsibility for any trading actions and their outcomes based on information in this article.

Conclusion: Discipline, the eternal alpha

The most precious legacy left by the Turtle Trading Rules to posterity is not those specific parameters (20-day, 55-day), but rather the principles it demonstratedSystematic Trading PhilosophyDecompose the decision process into explicit rules, use risk management to control downside, and let probability and time work in your favor. Legendary turtle trader Curtis Faith once said: "The success or failure of trading depends on whether you can stick to your plan."

In today's market driven by both algorithms and sentiment, perhaps the greatest advantage of individual investors is not information or speed, but ratherDiscipline and Patience——This is precisely what the Turtle Traders originally sought to prove, and also the ultimate alpha that enables any quantitative strategy to survive long-term. Starting from understanding this classic system and building your own systematic trading framework may be the most solid first step on the path to sustained profitable trading.

Authoritative reference source:

  1. Faith, Curtis. (2007). The Complete TurtleTrader: How 23 Novice Investors Became Overnight Millionaires. HarperCollins. (The Turtle Traders' Own Account of System Overview and History)
  2. Moskowitz, T. J., Ooi, Y. H., & Pedersen, L. H. (2012). Time series momentumJournal of Financial Economics, 104(2), 228-250. (A rigorous academic study of trend momentum strategies that can be viewed as modern academic validation of the Turtle Rules.)

The information contained in this report is for educational purposes only and should not be construed as investment advice. Historical backtest results are provided as statistical data and do not guarantee future performance.

Share this article

Subscription Plans

Find the research useful?

Compare publication subscriptions after exploring the previews.

Compare subscriptions

Related Posts

Volatility Targeting Strategy: A Dynamic Risk Regulator in Quantitative Trading—From Theory to Practical Implementation

Volatility Targeting Strategy: A Dynamic Risk Regulator in Quantitative Trading—From Theory to Practical Implementation

In rapidly changing financial markets, how to systematically manage risk is the key to long-term profitability. Volatility targeting strategy is precisely such a powerful risk management framework that dynamically adjusts portfolio risk exposure aimed at achieving stable risk levels. This article will deeply explore the mathematical principles behind it, analyze classic cases during the 2008 financial crisis and the 2020 pandemic crash, and provide practical Python implementation examples. We will reveal how to apply this technique commonly used by hedge funds to personal investment portfolios, pursuing returns while effectively taming market's wild volatility.

Quantitative Dissection of Seasonal Trading Strategies: Unveiling Statistical Truth and Practical Pitfalls in Month Effects and Holiday Effects

Quantitative Dissection of Seasonal Trading Strategies: Unveiling Statistical Truth and Practical Pitfalls in Month Effects and Holiday Effects

Over fifteen years of quantitative career on Wall Street, I have witnessed the rise and fall of countless strategies, and seasonal strategies, with their seemingly simple logic and tenacious vitality, have always been a fascinating corner of the quantitative toolkit. This article will, from the perspective of a seasoned quantitative trader, conduct a deep analysis of the statistical evidence, economic explanations, and microstructure causes behind "month effects" (such as the January effect and "Sell in May") and "holiday effects" (such as Christmas rallies and the periods around Thanksgiving). We will move beyond market rumors, employing rigorous backtesting frameworks, Python hands-on code, and real market cases (such as how the 2008 financial crisis distorted seasonal patterns), revealing how to convert these "calendar anomalies" into systematic strategies with risk-adjusted excess returns, while frankly discussing their data-snooping risks, structural decay, and stringent risk control requirements.

Time series analysis in quantitative trading practice: a complete guide from ARIMA forecasting to GARCH volatility modeling.

Time series analysis in quantitative trading practice: a complete guide from ARIMA forecasting to GARCH volatility modeling.

In the field of quantitative trading, price and volatility are more than numbers—they are complex time series containing market sentiment and risk. This article will take you deep into the discussion from classical ARIMA models to GARCH family models that capture volatility clustering. We will break down the mathematical principles behind them, share real-world application cases from Wall Street, and provide Python implementation examples. You will learn how to build a trading strategy framework combining mean and volatility forecasting, while understanding the limitations and risks of these powerful tools. This is not just a technical guide but the crystallization of experience from a senior quantitative trading professional.

Trading cost modeling: The invisible killer and winning key in quantitative strategies—an in-depth analysis from theoretical models to real-world tuning.

Trading cost modeling: The invisible killer and winning key in quantitative strategies—an in-depth analysis from theoretical models to real-world tuning.

In the quantitative trading arena, while the discovery of alpha is certainly thrilling, precise modeling and management of transaction costs often distinguishes paper profits from actual gains—a critical divide. This article will deeply dissect the core components of transaction costs—commissions, bid-ask spreads, and market impact costs—and reveal how the latter increases nonlinearly with order size. We will explore the classic Almgren-Chriss optimal execution model and through the 2010 "Flash Crash" and statistical arbitrage strategy case studies, demonstrate the catastrophic consequences of cost modeling errors. Finally, we provide a practical framework combining TWAP/VWAP, predictive models, and real-time monitoring with Python implementation examples, helping you transform theory into a solid shield protecting your strategy's Sharpe ratio.