Can We Predict Stock Market Dips? Testing a Mean Reversion Strategy on Tesla

Can We Predict Stock Market Dips? Testing a Mean Reversion Strategy on Tesla

A data-driven exploration of buying opportunities in volatile markets


Introduction: The Dip Buyer's Dream

We've all been there. You're watching a stock you love plummet day after day. Your heart races. Is this the bottom? Should I buy now? Wait another day and it drops further. You finally cave and buy... only to watch it fall another 10%.

Buying the dip sounds simple in theory, but in practice, it's one of the hardest calls to make. How do you know when a falling stock has truly hit bottom and is ready to bounce back?

In this article, I'm testing a systematic approach to identify these "mean reversion" opportunities—moments when a crashed stock is poised to recover. I built a dip detection algorithm and backtested it on 5 years of Tesla stock data (November 25, 2020 to November 24, 2025) to see if we can turn this gut-feel decision into a data-driven strategy.

Let's see if we can actually predict market dips, or if it's just wishful thinking.


What is a "Dip" Anyway?

Before we dive into the algorithm, let's define our terms clearly.

The Algorithm's Definition: A "Dip Signal"

My dip detection algorithm looks for four key conditions that, historically, suggest a stock has crashed but is showing early signs of recovery:

  1. Crash Magnitude (35% weight): The stock must have dropped at least 15% over the past 21 trading days. No minor corrections—we're looking for real crashes.

  2. Momentum Acceleration (35% weight): Here's where it gets interesting. We're not just looking for a bounce; we're looking for deceleration of the fall. If the stock was falling 5% per week and now it's only falling 2% per week, that positive acceleration suggests the crash is losing steam.

  3. Volatility Compression (15% weight): Panic creates volatility. When recent volatility (last 14 days) drops below longer-term volatility (prior 28 days), it suggests the panic selling is exhausting.

  4. Volume Evidence (15% weight): We look for two patterns:

    • Volume spike during crash: Did we see 3x normal volume during the selloff? (Panic selling)
    • Volume drying up now: Is current volume below 80% of recent average? (Exhaustion)

These four factors combine into a dip score (0 to 1). If all core conditions are met and the score exceeds 0.6, we get a dip signal—our algorithm's way of saying "This might be a good buying opportunity."

The Reality Check: An "Actual Dip"

To evaluate performance, I needed a ground truth. I defined an actual dip as any date where:

If you bought the stock at that day's close, you could achieve ≥10% profit within the next 21 trading days.

This is purely retrospective—we only know this in hindsight. But it gives us a way to measure: Did the algorithm correctly predict profitable buying opportunities?


Concrete Examples: How It Works in Practice

Let's look at real examples from the Tesla data to see how the algorithm works.

Example 1: A Successful Dip Signal

Date: December 20, 2021 Price: $299.98 Final Dip Score: 0.827

On this day, the algorithm triggered a buy signal. Here's how the score was calculated:

Component A: Crash Magnitude (35% weight)

  • Price 21 days ago: $365.46
  • Current price: $299.98
  • 21-day return: (299.98 / 365.46 - 1) = -17.9%
  • ✅ Condition met: Dropped 17.9% (≥15% threshold)
  • This severe drop indicated a real crash, not just noise

Component B: Momentum Acceleration (35% weight)

  • Price 7 days ago: $334.60
  • Current price: $299.98
  • 7-day momentum: (299.98 / 334.60 - 1) = -10.35%

How we calculate previous day's momentum:

  • Price 8 days ago: $356.32
  • Price 1 day ago: $310.86
  • Previous day's 7-day momentum: (310.86 / 356.32 - 1) = -12.76%

Acceleration (change in momentum):

  • Current momentum - Previous momentum = -10.35% - (-12.76%) = 2.41%
  • ✅ Condition met: Positive acceleration (deceleration of fall detected)
  • The selling pressure was slowing down—a key reversal signal

Component C: Volatility Compression (15% weight)

Volatility calculations (using log returns):

  • Recent volatility (last 14 days): 0.0345
  • Past volatility (prior 28 days): 0.0456
  • Compression ratio: 0.0345 / 0.0456 = 0.756
  • ✅ Condition met: Ratio < 1.0 (recent volatility is lower)
  • Recent volatility was 75.6% of past volatility
  • Market panic was subsiding as volatility compressed

Component D: Volume Evidence (15% weight)

Volume spike detection:

  • Max volume during crash (last 21 days): 108,515,100
  • Baseline volume (42 days before crash): 81,613,686
  • Spike ratio: 108,515,100 / 81,613,686 = 1.33x
  • ⚠️ No major spike (< 3x baseline)

Volume drying up:

  • Current volume: 56,480,100
  • Recent 14-day average: 72,978,557
  • Current vs average: 56,480,100 / 72,978,557 = 0.77x
  • ✅ Volume drying (< 0.8x average)

Component D conclusion:

  • ✅ Volume criteria met (evidence of panic followed by exhaustion)
  • Pattern: High volume spike during crash → volume drying up now = capitulation complete

Result: All conditions passed, generating a dip score of 0.827.

What happened next? ✅ Success! The stock gained 33.3% over the next 14 days. This signal correctly identified a profitable dip.


Example 2: An Actual Dip (That Was Missed)

Date: January 05, 2023 Price: $110.34

This date qualified as an "actual dip" by our definition, but the algorithm did NOT trigger a signal.

Why it qualified as an actual dip:

  • Entry price: $110.34
  • Forward return: 76.5% in 32 days
  • ✅ Exceeded the 10% profit threshold within 21 days
  • This was objectively a good buying opportunity (in hindsight)

Why the algorithm missed it: The algorithm failed to meet the conditions:

  • Price 21 days ago: $182.45
  • Current price: $110.34
  • 21-day drop: (110.34 / 182.45 - 1) = -39.5%
  • ✅ Drop condition met (≥15%), but other conditions failed
  • Final dip score: 0.350 (needed ≥0.6)

This example shows the algorithm's conservative nature—even though the stock had crashed 39.5%, it missed this profitable opportunity (which gained 76.5%!) because not all technical conditions aligned.


The Experiment: 5 Years of Tesla Data

Dataset

  • Stock: Tesla (TSLA)
  • Period: November 25, 2020 to November 24, 2025
  • Total trading days: 1,255 days
  • Data source: Yahoo Finance via yfinance library
  • Price range: $108.10 to $479.86

The Test

For each trading day (after accumulating 64 days of history for calculations), I ran the algorithm using only past data. The algorithm had no knowledge of future prices—it could only look backward, just like a real trader would.

Then I compared:

  • Dip signals: Days when the algorithm said "buy"
  • Actual dips: Days that were objectively good buying opportunities (in hindsight)

Results: The Algorithm's Performance

The Big Picture

Let's start with the most important visual—where did the algorithm spot opportunities, and how many did it miss?

Tesla Dip Signals vs Actual Dips

Figure 1: Blue line shows Tesla's price over 5 years (from $191.33 to $417.78). Red circles (○) mark the 29 dip signals detected by our algorithm. Green triangles (△) mark all 513 actual profitable dips. Where red and green overlap = successful predictions.

This chart tells a fascinating story:

The algorithm is extremely conservative. Out of 513 actual profitable dips over 5 years, it only triggered 29 signals—catching just 2.1% of all opportunities.

But here's the key question: When it did signal, was it right?

Signal Accuracy: 37.9%

Of the 29 dip signals the algorithm generated:

  • 11 were successful (37.9%) - they achieved ≥10% profit in 21 days
  • 18 failed (62.1%) - they didn't reach the 10% threshold

The algorithm's success rate was 37.9%—meaning when it said "buy," there was roughly a 4 in 10 chance you'd make at least 10% profit within 21 days.

At first glance, 37% might sound disappointing. But here's the interesting part: even the "failed" signals weren't disasters. Let's look at the actual returns:

Return Analysis

Average returns across all signals: 10.2%

Breaking it down:

  • Successful signals (those hitting ≥10%): Average return of 22.8% in 21 days
  • Failed signals (those missing the 10% mark): Still averaged 2.6% in 21 days

Even when "wrong," the algorithm typically identified downturns that bounced back somewhat—just not enough to clear the 10% bar. A 2.6% average return on failed signals means you'd still profit more often than not, even from the misses.

The successful signals, averaging 22.8% in just 21 days, were the home runs that made the strategy compelling.

The Conservative Nature

The algorithm detected only 2.1% of all actual dips (11 out of 513). This reveals its extremely conservative nature—it would rather miss opportunities than give false signals.

The average dip score across all 29 signals was 0.736, showing that most signals came in with high confidence when they did trigger.


What the Chart Reveals

Looking at Figure 1, several patterns emerge:

Cluster During Volatility: The red circles (signals) aren't randomly distributed. They cluster during periods of obvious market stress—exactly when you'd want a systematic approach to overcome fear.

Many Missed Opportunities: The sea of green triangles (actual dips) shows just how many profitable opportunities existed. The algorithm's strict criteria filtered out most of them—502 potential winners were never flagged.

Precision Over Recall: The algorithm prioritizes being right when it speaks up, rather than catching every opportunity. Of its 29 signals, 11 (37.9%) were genuinely profitable at the ≥10% level.


What Worked (and What Didn't)

Strengths

Systematic risk-taking: The algorithm activates during market crashes, not random noise ✅ Positive expectancy: Even failed signals averaged 2.6% gain ✅ High-quality signals: Successful calls delivered 22.8% in just 21 days ✅ Emotionless execution: No fear or greed influencing the decision

Weaknesses

Extremely low detection rate: Caught only 2.1% of actual opportunities ❌ Too conservative: Requiring all 4 conditions filtered out 502 real dips ❌ 62% "failure" rate: Majority of signals didn't hit the 10% target ❌ Volume criteria may be too strict: Tesla's erratic volume patterns might not fit the model

The Threshold Problem

Remember, "actual dips" required ≥10% gain in 21 days—a high bar. Many signals that achieved 7-9% gains were technically "failures" by this metric, even though they were profitable trades.

If we lowered the threshold to 5%, the accuracy would jump significantly. But that's moving the goalposts after seeing the results.


Real-World Implications

Could You Trade This?

Here's what the data tells us:

The Good News:

  • The algorithm provides a systematic way to identify crash recoveries
  • Average return across all signals is 10.2% in 21 days—respectable for any strategy
  • Even "wrong" signals rarely lose money (averaging 2.6%)
  • When it's right, it's really right (22.8% average on winners)

The Reality Check:

  • 37.9% accuracy means you'll be wrong more often than right
  • You'd need proper position sizing to handle the 18 failed signals
  • Transaction costs and taxes would reduce these theoretical returns
  • You'd miss 97.9% of actual opportunities by relying solely on this

Improvement Ideas:

  1. Relax the criteria: Maybe require 3 of 4 conditions instead of all 4
  2. Adjust thresholds: Lower the 15% crash requirement or 10% profit target
  3. Ensemble approach: Use this as one signal among several indicators
  4. Add fundamental filters: Combine with earnings, market regime, or sentiment data

Conclusion: The Dip Detector's Verdict

Can we predict stock market dips? Kind of.

Over 1191 trading days, this algorithm identified 29 potential buying opportunities. Of those, 11 (37.9%) delivered the promised ≥10% gain in 21 days.

But it also missed 502 actual dips by being overly cautious—catching just 2.1% of all profitable opportunities.

Here's my takeaway: Predicting dips is hard. Really hard. Even a well-designed, multi-factor algorithm can only call it right about 4 times out of 10. But having any systematic edge beats pure gut feeling—especially when the average signal returns 10.2% in just 21 days.

If I were using this in real trading, I'd:

  • Treat signals as watchlist alerts, not automatic buy triggers
  • Combine with other analysis (support levels, broader market trends)
  • Accept that even good systems will be wrong 62% of the time
  • Focus on the fact that successful signals averaged 22.8% returns

The bottom line? Buying the dip will always be part art, part science. This algorithm gives you the science part—a systematic way to identify 29 potential opportunities out of 1191 trading days, with 37.9% accuracy when it speaks up.

The art—knowing when to trust it, how much to risk, and when to override it—is still up to you.


Methodology Summary

Algorithm Parameters:

  • Crash lookback period: 21 days
  • Minimum drop threshold: 15%
  • Momentum window: 7 days
  • Volatility window: 14 days
  • Volume spike factor: 3x
  • Profit target: ≥10% in 21 days

Performance Metrics:

  • Total trading days: 1,255
  • Days analyzed: 1,191
  • Dip signals generated: 29
  • Successful signals: 11 (37.9%)
  • Failed signals: 18 (62.1%)
  • Actual dips in dataset: 513
  • Detection rate: 2.1%
  • Average signal return: 10.2%
  • Average successful return: 22.8%
  • Average failed return: 2.6%
  • Average signal score: 0.736

Generated on November 29, 2025 | Reading time: ~8 minutes

Enjoyed this article?

Get weekly investment insights and market analysis delivered to your inbox

Free weekly insights. Unsubscribe anytime.

Sign in to add a comment or like.

Comments (0)

No comments yet. Be the first to comment!