All projects

16 / Ventures & FinanceStock Market

Darvas Box Strategy Backtest

Testing the 1950s Darvas box breakout strategy on every US stock since 1990 · September 2026

Drawing of a price line stepping up through stacked boxes
Overview

Study objective

In the 1950s Nicolas Darvas turned a small account into about $2 million and described how in a best-selling book. His method has two halves: a judgement about which companies are worth owning, and a mechanical procedure for when to buy and sell them, built around price “boxes”.

The judgement cannot be tested, but the procedure can. I tested whether the mechanical half has an edge on its own, without the trader’s judgement, and whether optimizing every parameter, including the one number Darvas fixed, could produce a version that holds up on data not used to fit it.

It does not. The rules as written lost to randomly chosen stocks. Optimization produced a strong fitted result that mostly disappeared out of sample, and the remaining profit came from a different source: takeover targets. The main output of the project is the test itself, built so that a negative answer could be trusted.

Backtests only. Nothing on this page was traded, on paper or with real money.

Scope of work

Backtest engine and test design

  • Data

    Survivorship-free universe

    Every US operating company from 1990 to 2026, including the 71% that later delisted, with a per-day flag for whether the stock was listed on a major exchange at the time.

  • Engine

    Sub-second backtest engine

    Two numba kernels: one turns the box rules into a stream of events for every stock, the other steps a portfolio through the calendar. One full-universe run takes 0.3 to 0.5 seconds.

  • Search

    Bayesian optimization

    Gaussian-process optimization over 20 parameters, including the three-day window Darvas treated as fixed, with walk-forward folds before the final fit.

  • Controls

    Falsification tests

    Random-entry controls, one-at-a-time sweeps, plateau checks around the optimum, and a single hold-out period that the code refuses to run twice.

01 · Method

Darvas box rule set

I first wrote the method down as explicit rules, then implemented it as a four-state machine that reads one daily bar at a time for each stock. Buy orders rest above the box before the market opens, so every decision uses only the previous day’s close.

  • Step 1

    New high on heavy volume

    A stock makes a new high while trading well above its normal volume. That day’s high becomes the provisional top of a box.

  • Step 2

    Three-day box confirmation

    The top is confirmed when price fails to touch it for K = 3 days in a row, then the bottom the same way. Darvas fixed only this one number.

  • Step 3

    Breakout entry and trailing stop

    A resting buy order sits just above the box. Once filled, a sell stop sits under the box floor and moves up under each new box. There is no profit target.

Price chart of one stock from mid-1997 to late 1998 rising from about 5 to about 55. A stepped red line shows the confirmed floor stop rising under the price, and green triangles mark six buy-stop fills on the way up.
The rules working as intended on the largest winner in the backtest: each green triangle is a breakout fill, and the red line is the stop stepping up under each new box
02 · Data and engine

Universe data and backtest engine

Most breakout candidates are small companies, and most small companies from 1990 no longer exist. I built the universe from both the live and the delisted databases of a commercial data provider: every US operating company, excluding funds, trusts and blank-check shells, tradeable only on days it was listed on a major exchange.

The engine separates signals from portfolio. A numba kernel runs the box state machine across all 58 million bars and emits a sorted stream of events; a second kernel steps a $100,000 cash account through the calendar, competing signals for a limited number of positions. Signal results are cached by parameter, so sweeps that only change portfolio settings skip the expensive part.

That speed made the rest of the study possible: thousands of full-market backtests in under half an hour on one workstation.

Scale of the study

Symbols in the two source databases
35,898
Operating companies kept
22,693
Share of those that later delisted
71.4%
Daily bars cached
58.2 million
Time to build the cache
211 seconds
Optimizer trials run
2,200
One-at-a-time sensitivity runs
104
Random-entry control runs
1,000
03 · Literal rules

Literal-rule backtest results

With Darvas’s own three-day window, $100,000 grew to $1.99 million by March 2000 and then lost 94% of it. Over 1990 to 2014 the strategy made 2.4% a year against 9.7% for the S&P 500. The reason is mechanical: a three-day box is so short that the stop sits inside ordinary daily noise. 97.8% of trades ended on a stop, after a median of 17 days.

Log-scale equity curves from 1990 to 2014. The literal Darvas strategy with 10 positions rises far above the S&P 500 and Russell 3000 by 2000, then falls below them and ends near 180 against roughly 1,000 for the indices.
The literal rules against the S&P 500 and Russell 3000, 1990 – 2014, log scale. All of the profit is the late-1990s small-cap bubble
Histogram of Sharpe ratios from 200 random-entry simulations, spread from about 0.2 to 0.78 and centred near 0.5, with a vertical line for the Darvas strategy at 0.22 at the far left edge.
Random stocks bought on the same days with the same exits (blue), against the Darvas entries (orange line). The strategy beat one run in 200
Sharpe ratio of the literal rules as the confirmation window changes · 1990 – 2014 · everything else unchanged
  • K = 0buy any new high−1.52
  • K = 1−1.10
  • K = 2−0.18
  • K = 3Darvas’s rule+0.22
  • K = 7+0.47
  • K = 8+0.40
  • K = 10+0.55

Sweeping one parameter at a time located the weakness. Most parameters gave noisy, directionless responses, which is consistent with a weak signal. The confirmation window was the exception: longer is better, up to the top of the range. The one number Darvas fixed was the most important parameter, and three days is the wrong value for modern US stocks.

A market filter, trading only when the S&P 500 is above its 200-day average, more than doubled the Sharpe ratio (0.22 to 0.53) and halved the drawdown. That helped more than any change to the box itself.

04 · Optimization and hold-out

Optimization and hold-out results

I then ran a Gaussian-process optimizer over 20 parameters on 1990 to 2014, with a floor on trade count so that it could not score well by rarely trading. The fitted system was more selective: an eight-day window, boxes no taller than 10%, volume four times normal, small positions. On the fitted window that made 8.5% a year with a 5.6% worst drawdown and a Sharpe ratio of 1.67.

I then ran it once on 2015 to 2026, a period not used to fit any parameter. The Sharpe ratio there was 0.28.

Sharpe ratio on the window the parameters were fitted on, and on the locked hold-out
  • 1990 – 2014 (fitted)
  • 2015 – 2026 (hold-out, run once)
  • Literal Darvas rules0.22−0.35
  • Optimized parameters1.670.28
  • Optimized, liquid stocks, 2.5× slippage0.860.17
  • S&P 500 total return0.600.82
Log-scale equity curves for the hold-out, 2015 to 2026. The S&P 500 and Russell 3000 rise to about 450. The three optimized variants stay nearly flat just above 100. The literal Darvas rules fall to about 21.
The hold-out, log scale: both indices climb, the optimized variants stay nearly flat, and the literal rules lose 79%
All figures are backtests on $100,000, cash only, after commissions and slippage. Hold-out is January 2015 to September 2026, evaluated once. Sharpe uses a zero risk-free rate.
RunWindowReturn per yearSharpeWorst drawdownTrades
Literal rules1990 – 20142.4%0.22−93.9%2,782
Literal rulesHold-out−12.4%−0.35−86.3%1,449
Optimized (fitted on this window)1990 – 20148.5%1.67−5.6%552
OptimizedHold-out1.2%0.28−16.0%401
Optimized, liquid stocks only, 2.5× slippageHold-out0.7%0.17−21.6%365
S&P 500 total return1990 – 20149.7%0.60−55.3%–
S&P 500 total returnHold-out13.8%0.82−33.8%–

Overfitting indicators before the hold-out

  • Bounds

    Best set on nine search limits

    An optimum on the edge of its allowed search range indicates a direction, not a final value.

  • Spikes

    One-integer peak at K = 8

    The Sharpe ratio was 1.24 at K = 7, 1.67 at K = 8 and 1.48 at K = 9. A real effect does not depend on one integer.

  • Costs

    Drift into illiquid stocks

    With flat 0.1% slippage, the optimizer pushed the liquidity floor to its minimum. Realistic floors and 2.5× slippage cut the fitted Sharpe from 1.67 to 0.86.

  • Walk-forward

    Optimistic walk-forward estimate

    Stitched out-of-sample folds inside 1990 – 2014 gave a Sharpe of 0.88. The true hold-out gave 0.28. Folds inside one window shared too much with the final fit.

Fifteen small line charts, one per parameter, showing the fitted Sharpe ratio as each parameter is varied by plus or minus 50 percent around the optimum. The panel for K shows a sharp isolated peak at 8; several others peak at the edge of their range.
Plateau check: the fitted Sharpe ratio as each parameter moves ±50% around the optimum. A robust result appears as a flat plateau. The panel for k is a single spike
05 · Profit attribution

Hold-out profit attribution

A later review of the trade files, which my first report had missed, split the profit by how each position ended. In the hold-out, the 304 ordinary closed trades lost money. The entire net profit came from 85 positions held until the stock delisted and 12 still open on the final day.

The delisted positions do not look like breakouts. While held, their median annualized volatility was 3.3%, against 22% for the other trades, and 65% were winners with a median gain of 0.4%.

That is the profile of an announced acquisition. A takeover bid makes a stock jump to a multi-year high on several times its normal volume, which passes the volume and new-high tests. It then trades in a range of a few percent until the deal closes, which passes the tight-box test, and it leaves the market at the deal price. The optimizer had tuned a breakout system into a takeover detector, and those are merger-arbitrage returns, not evidence for the box method.

Optimized system, hold-out 2015 – 2026 · net profit on $100,000 by how each position ended · 401 trades
  • 85 positions held into a delisting+$9,625
  • 12 positions still open on the last day+$14,808
  • The other 304 trades−$9,655
  • Net profit+$14,779

Conclusion. Darvas’s mechanical procedure is not an edge on its own in this data. The one property that survived is risk containment: the optimized system’s worst hold-out drawdown was 16% against 34% for the S&P 500, at about 40% exposure, for roughly one-twelfth of the index’s return. His results came from what this test removed: his stock selection, heavy concentration on margin, and a strong bull market.

Verification

Verification and controls

  • Universe

    Delisted companies included

    68% of the literal strategy’s trades were in stocks that later delisted. A database of survivors only would have produced a different and invalid study.

  • Verification

    Two independent implementations

    A separate plain-pandas version of the rules agreed with the fast kernel event for event on 40 real symbols. 28 tests pass.

  • Look-ahead

    Future-data leak tests

    Tests cut off or scramble all later data and confirm that no earlier signal changes. Orders are resting before the open and use only the prior close.

  • Hold-out

    Single locked evaluation

    The 2015 – 2026 period was run once. The list of candidates, including a pessimistic cost variant, was fixed in code beforehand, and a lock file records that it was not re-run.

  • Costs

    Transaction costs in every figure

    $0.005 a share commission and 0.10% slippage per side, cash only, no leverage. Gaps through a stop fill at the open, not at the stop.

  • Limits

    Known limitations

    Daily bars cannot show whether a day’s low came before its high, so a same-day stop rule is pessimistic for the literal rules and makes the random-entry comparison less clean. Sharpe ratios use a zero risk-free rate.

Method

Six-stage study pipeline

  1. 01

    Build a survivorship-free, point-in-time price cache for the whole US market.

  2. 02

    Run Darvas’s rules exactly as written, against two index benchmarks.

  3. 03

    Sweep each parameter one at a time and compare the entries with random stock picks.

  4. 04

    Walk-forward optimization: four folds of 300 trials inside 1990 – 2014.

  5. 05

    Two final 500-trial optimizations on 1990 – 2014, with plateau checks around the best set.

  6. 06

    One locked evaluation on 2015 – 2026, then attribution of where the profit came from.

Every figure is a backtest on daily data from 1990 to September 2026. Past performance does not predict future results. Nothing here is investment advice.