Stock Splits in Backtests
Split-adjusted or as-traded prices in your backtesting database, and what each one gets wrong in a backtest
When a stock splits, every price before the split is on a different scale from every price after it. Your backtesting database can store that history in one of two ways, and neither one is right for everything:
Split-adjusted prices rescale everything before a split to match the shares after it. The Massive Flat Backfiller's
--adjust option does this.
Today's prices are the same either way. Only history changes. Whichever you choose, one family of measures in your backtest is wrong, so you need to know which one.
An example
XYZ closes at $0.20, does a 1-for-20 reverse split overnight, and opens the next morning at $4.00. Nothing happened to the company: each new share is 20 old ones.
| Close before the split | Open after the split | Gap | |
|---|---|---|---|
| As-traded | $0.20 | $4.00 | +1,900% |
| Split-adjusted | $4.00 | $4.00 | 0% |
The as-traded gap is fake. The adjusted history is wrong in a different way: it says XYZ closed at $4.00 the day before, when it really traded at $0.20.
A forward split is the mirror image. A $400 stock that splits 4-for-1 opens at $100: as-traded, that's a 75% crash. Adjusted, its history shows $100 on days it really traded at $400.
What as-traded prices get wrong
Anything that reaches back across a split sees the fake jump:
- the gap from yesterday's close
- the change over 5, 20 or 60 days
- moving averages and N-day highs and lows
- ATR and other ranges that span days
- average volume and relative volume, since the share count changes at the split too
This hurts gap and momentum systems the most. A gap-up short system sees every reverse split as an enormous gap and shorts it. A dip-buying system sees every forward split as a crash and buys it. Those trades never happen live, because the live scanner sees no gap. Others go missing: a real move after a split gets measured against the wrong base.
The fake trades rarely look harmless. Their signals are extreme, so they tend to show up among the biggest winners and losers, which is exactly where they distort a backtest most.
What split-adjusted prices get wrong
Anything that depends on the price or share count on a past date:
- Price floors and ceilings. A stock that traded at $0.50 and later did a 1-for-20 reverse split shows as $10.00 in adjusted history. A
$10 minimum pricefilter lets it through, at a price nobody could trade. A forward split does the opposite: a stock that really traded at $400 shows as $100, which matters for a maximum price filter. - Share volume. Volume is adjusted the other way, so the reverse-split stock shows 20 times fewer shares than really traded. Share-volume filters are off. Dollar volume, price times volume, comes out the same on either series, which is one more reason to filter on it: see Liquidity Filters.
- Entry prices, share counts and per-share costs. The entry price in your trade list is the adjusted one. A $10,000 position at an adjusted $10.00 is 1,000 shares; at the real $0.50 it was 20,000 shares, with 20 times the per-share commission. A penny spread is 0.1% of $10 but 2% of $0.50. See Commissions in Backtests.
- Results that change later. Each
--adjustrun rescales a symbol's history for its new splits, so the same backtest run next month can pass or fail a price floor differently.
The trades this affects are concentrated in stocks that later did a reverse split, which are mostly cheap, struggling small caps. A price floor is often there to keep those out.
Percentages, gaps, ratios and returns are right on adjusted data: a percent move is the same on any scale.
Which one I use
I use split-adjusted data for backtesting:
- Its errors are narrower. They come only through price and share-volume levels on past dates, and only on stocks that later split. As-traded errors create trades from signals that never existed, in exactly the gap and momentum columns most of my systems are built on.
- The lookbacks match live trading. Live, today's price is real and yesterday's is on today's scale, because the split already happened. Adjusted history gives every gap and N-day change that same view. The Signal Engine reads split-adjusted files for this reason.
- The price floor can be checked afterward. See below.
The backfiller only adjusts for splits up to the last --adjust run, and AmiBroker only has the adjusted bars once you import them. Downloading Massive Data into AmiBroker covers both.
Checking price floors against as-traded prices
The backfiller keeps a list of every split it has applied in .splits_applied.csv, in the CSV folder. Each row has the symbol, the ExecutionDate, and SplitFrom and SplitTo. A 1-for-20 reverse split is SplitFrom 20, SplitTo 1.
To turn an adjusted price back into the price that traded, multiply it by SplitTo / SplitFrom for each split of that symbol after the trade's date. For the example above, $10.00 × 1 / 20 = $0.50.
You don't need to write code for this. Give Claude your trade list and .splits_applied.csv, and ask:
For each trade, multiply the entry price by SplitTo / SplitFrom for every split of that symbol after the entry date, and add the result as an as-traded entry price column. Then show me the trades whose as-traded entry price is below my $X price floor.
Remove those trades, then recompute share counts and commissions for the rest at the as-traded prices before you crunch the backtest.
If you backtest on as-traded data
The simplest fix is to skip every trade whose lookback crosses a split. A system using the 20-day change skips a symbol for 20 trading days after each of its splits. Massive's splits list tells you where they are.
The complete fix stores both: the as-traded prices plus the split adjustment beside them, so each column uses whichever is right for it. Joining Futures Contracts for Backtesting does this for futures rolls, which are the same problem four times a year.
Before you trust a backtest
- Know which kind of prices your database holds.
- Look at the biggest winners and losers. Check whether any of those symbols split within your longest lookback before the trade.
- On adjusted data, check the trades against your price floor at as-traded prices.
- On as-traded data, drop the trades whose lookback crosses a split.