DEV Community

Cover image for When to Sell Winning Stocks? I Backtested My "Half-Profit Take" Rule Against 15 Exit Strategies – My Current Rule Dominated!
oji - building AI in public
oji - building AI in public

Posted on

When to Sell Winning Stocks? I Backtested My "Half-Profit Take" Rule Against 15 Exit Strategies – My Current Rule Dominated!

Hey there, it's OJ. I build and run AI trading bots as a side gig.

Today, I'm not talking about bots, but the core investment strategy behind them. Specifically, the age-old question every growth investor faces: "When should you sell a winning stock?"

My current rule is super simple: "Once a stock doubles (+100%), I take half the profit to recoup my initial investment. The remaining half I hold indefinitely, until I judge the company's business model to be structurally broken."

I've followed this rule for years, feeling it was intuitively sound. But a nagging doubt recently crept in: "Is this truly optimal?" Maybe there's a smarter way to sell. Like a trailing stop-loss that sells if the price drops X% from its peak, or selling when it breaks below a moving average.

As an engineer, when a question arises, I want to validate it with data. So, I rigorously backtested my current rule against 15 alternative exit strategies. Here's the full breakdown.

The Rules for Validation: No Cheating with Hindsight

First off, the biggest pitfall in these kinds of validations is "curve fitting" – creating rules that conveniently fit past data. To avoid this, I set strict guidelines:

  1. Pre-registered Strategies: All 16 strategies (including my current one) were defined before the test began, with no changes allowed.
  2. Validation Data: I used 26 years of stock price data.
  3. Target Episodes: I analyzed 5,651 investment episodes (i.e., a complete buy-to-sell cycle for a single stock), derived from my past investment decisions.

I compared four main categories of strategies:

  • Price Trailing: Sell if it drops -15%, -30%, or -45% from its peak.
  • Time-Based: Forced sale after 1, 3, or 5 years.
  • Trend-Following: Sell on a 50-day/200-day moving average cross.
  • Relative Strength: Sell if it underperforms the S&P 500.

...and 15 other patterns in total. I compared these with one half of my current rule: "No Exit (don't sell unless the business dies)."

(Note: My current rule is a hybrid of "take half profit at +100%" and "hold the rest indefinitely." For simplicity in this comparison, I'm treating the "hold indefinitely" part as P0 and comparing it against other pure exit strategies.)

The Results: My Current Rule Was a Landslide Victory. The Difference Was Stark.

To cut to the chase, my current rule (P0: No Exit) completely crushed all the alternatives.

Here are the backtest results for all 5,651 episodes. Returns are shown as a multiple of the initial capital (where 1 is breaking even).

| Policy | Median | Average | 5x Capture Rate |
|---|---|---|---|
| P0 No Exit (Current) | 1.594 | 2.122 | 23.6% |
| P1 -30% Trailing | 0.995 | 1.295 | 7.3% |
| P2 -45% Trailing | 1.124 | 1.581 | 14.7% |
| P3 -60% Trailing | 1.251 | 1.776 | 18.9% |
| P4 200-day MA Break | 1.021 | 1.332 | 8.1% |
| P5 Sell in 3 years | 1.218 | 1.487 | 10.2% |
... (Truncated) ...
Enter fullscreen mode Exit fullscreen mode

As you can see, P0 topped the charts in every metric: median return, average return, and "5x capture rate" (the percentage of episodes that resulted in a 5x or greater gain).

What's particularly striking is the poor performance of "selling on weakness" strategies, which many people tend to do. For example, P1: -30% Trailing had a median return of 0.995, meaning over half the trades ended in a loss. By cutting off big winners too early, the average return barely grew. Frankly, I found this result quite alarming.

Ultimately, a temporary -30% or -50% dip in a stock price is often just noise for a growth stock. Reacting to that noise and selling means missing out on the subsequent 10x, 20x, or even larger returns. The data starkly demonstrated this.

The Lesson: Sell "The End of the Business," Not "Weakness."

The biggest takeaway from this validation is a reaffirmation of a core truth: the vast majority of returns in growth investing come from a very small number of big winning stocks.

Therefore, the most crucial aspect of an exit strategy is "how to hold onto those big winners without letting them go."

The "No Exit" strategy, which dominated this test, embodies precisely that. Of course, it's not truly holding forever. The overarching rule is always: "Sell if the business fundamentals deteriorate." In other words, the reason to sell should be about the business itself (its end), not just stock price fluctuations (weakness).

Given these results, I'm now fully confident that my current hybrid rule – "Take half profit at +100%, and hold the remaining half until the business fundamentals deteriorate" – is empirically sound and highly rational:

  • Half Profit Take: Contributes to mental stability and risk management, creating a "can't lose" situation.
  • Hold Remaining Half Indefinitely: Ensures I don't miss out on the "major upside" that is the true source of profit.

Naturally, this is just the optimal solution for my investment style. It won't apply to short-term traders. But if you're a fellow engineer investing in growth stocks for the long term, I strongly recommend you validate your own exit rules with data.

Your intuitively chosen rules might actually be costing you significant returns. For me, this validation eliminated my doubts and gave a clear direction to my future investment decisions. Glad I did it. 👍

Top comments (0)