Playbooks

SNDK 20-Day Trend Flip: +3,141% Long/Short Backtest

Published

This strategy uses one number and one rule. Each day it asks whether SanDisk is trading above or below its average price of the last 20 days. Above means it holds a full long position. Below means it holds a full short position. On the SNDK perpetual, from March 2025 to October 2026, this rule turned $10,000 into about $324,000. Holding the stock would have turned $10,000 into about $294,000.

How the strategy works

The strategy trades xyz:SNDK-USDC-PERP. This perpetual contract tracks SanDisk, the flash-memory maker that Western Digital spun out in early 2025. The strategy uses daily bars and no leverage. It computes one factor: the distance of today's close from the 20-day simple moving average.

devt=Pt120∑i=019Pt−i−1wt={+1devt>0−1devt≤0\text{dev}_t = \frac{P_t}{\tfrac{1}{20}\sum_{i=0}^{19} P_{t-i}} - 1 \qquad w_t = \begin{cases} +1 & \text{dev}_t > 0 \\ -1 & \text{dev}_t \le 0 \end{cases}

The target position w is +100% of equity (long) or −100% (short). The strategy sends an order only when the target side differs from the position it already holds. As a result, it does not trade every day. It sits in a position until the price crosses its average, then it flips.

Daily close of SNDK dev = close ÷ 20-day average − 1 dev > 0 dev ≤ 0 Target: 100% long Target: 100% short Trade only when the side changes
The whole rule. Days that lack 20 closes of history are skipped. A deviation of exactly zero counts as short.
LONG SHORT LONG Price 20-day average Flip
Illustration of the rule. When the price falls below its trailing average, the position flips to short. When the price recovers above the average, it flips back to long.

Backtest results

Test period: 15 March 2025 to 8 October 2026, with $10,000 starting capital, 1x leverage, and 0.03% friction per trade.

+3,141.39%

Annual return

+816.92%

2.75

Max drawdown

53.59%

MeasureValue
Total return+3,141.4%
Buy and hold SNDK+2,835.9%
Annualized return+816.9%
Sharpe ratio2.75
Max drawdown−53.6%
Trades43
Fees−12.2%
Funding0.0%
Average long exposure73.2%
Average short exposure23.1%

14 of 20 calendar months were positive, although July 2026 was positive by only 0.01%. Most of the return came from a few explosive months. September 2025 returned +114% and January 2026 returned +143%. The losing months were small by comparison. The worst were November and December 2025, at about −15% each.

150% 100% 50% 0% +114% +78% ← +143% Mar 2025 Jan 2026 Oct 2026
Monthly strategy returns. March 2025 and October 2026 are partial months.

Why the strategy works

1. It rides trends and cuts reversals

This is time-series momentum, also called trend following. An asset that has risen over the past few weeks tends to keep rising for a while, and the same holds for falls. A 20-day window covers about one trading month of daily bars. That is short enough to catch a new move early and long enough to ignore single-day noise. During SNDK's large rally, the price spent most days above its average. The strategy was long 73% of the time on average and short 23%.

2. The payoff is lopsided

The next flip ends every losing position, so losses stay small. A winning position runs until the trend breaks, however far that is. A few big trends paid for the rest. In the chart below, the strategy's two best months alone multiplied the final result by about five.

Strategy 32.4× Buy and hold SNDK 29.4× Strategy without Sep 2025 and Jan 2026 6.2×
Growth of $1. The figures compound the monthly returns. Removing the two best months shrinks the result from 32.4× to 6.2×.

3. Chop is the cost

The rule only reacts after a move has started. When the price moves sideways around its average, each flip comes late. The strategy then buys after a rise and sells or shorts after a dip. This behavior probably explains the losses in November–December 2025 and March 2026, and it is part of the reason for the 43 trades and −12.2% in fees.

Flip to long Flip to short 20-day average
Illustration of a whipsaw. In a range, every flip comes after the swing has started. Each round trip loses a little and pays fees.

An honest read

The stock itself rose about 29× over the test, so much of this result is SNDK's rally. Any rule that was mostly long would look strong here. The rule beat buy-and-hold by a modest margin, 32.4× against 29.4×. It also suffered a 53.6% drawdown on the way. The short side is a hedge for a sustained decline, which this sample did not contain. Within this test, the short trades mostly paid for protection that was never needed. This is a single-asset test over 19 months, so treat it as a starting point for your own testing.

Ideas to improve it

Idea 1: Long or flat instead of long or short

In a strong secular uptrend, short positions mostly lose money during dips that later recover. A long-or-flat version steps aside below the average instead of betting against the trend. Test whether it keeps most of the upside with a smaller drawdown.

Idea 2: Add a no-trade band to cut whipsaws

Require the price to move clearly away from its average before flipping. With a ±3% buffer, small wiggles around the average stop triggering trades. This should reduce the number of trades and fees, and it may soften losing months like those in late 2025.

Build your own

This whole strategy is one factor and one if-statement. You can swap the asset, change the 20-day window, add a band, or combine two averages. Describe your idea in plain words and AlphaPilot will write and backtest it for you.

Built by an AlphaPilot user. Historical backtest results do not predict future returns. Not investment advice.