Investment Strategy Backtest (Shannon's Demon, Rebalancing, Dollar-Cost Averaging and Moving Averages on Daily Data)
Completely free, with no extra charges. You may freely use the output commercially.
About this tool
Using long-run daily data for US stocks, Japanese stocks, US Treasuries and Japanese government bonds, this tool simulates how your money would have grown or shrunk if you had traded by rules such as “Shannon's Demon” (rebalancing to a 50/50 split with cash), fixed-ratio rebalancing, dollar-cost averaging, a moving-average filter or momentum. Every result is shown side by side with buy and hold: putting the same amount into the asset on day one and keeping it.
Choose the asset, the strategy, the amount and the period and the result appears. If you need to, you can change strategy settings such as the rebalancing frequency or the moving-average length, as well as the valuation currency, the interest earned on cash and trading costs. You can also load a CSV of daily closing prices that you obtained yourself. All processing happens entirely in your browser (no data is sent).
Enter the conditions
Results
Loading data…
Final value
Strategy—
Buy and hold (full amount)—
Returns by year
How to use it and how it calculates
Basic use
Choose the asset, strategy, initial amount, start date and end date, and the results update with every change. You can also pick a period with the buttons such as “Full period” or “Last 30 years”. Hover over or tap a chart to see the portfolio value on that day. Because the value can change by several orders of magnitude over decades, the chart starts on a log scale, where the same height always means the same multiple.
What each strategy does
- Shannon's Demon An idea said to have been presented by Claude Shannon, the founder of information theory. Split the money 50/50 between the asset and cash; when the asset rises and its share grows, sell some, and when it falls, buy more, so the split always returns to the original ratio. You can change the ratio and the timing.
- Two-asset fixed-ratio rebalancing Hold two assets at a set ratio, such as 60% stocks and 40% bonds, and restore the ratio periodically. By default the second asset is the same country's 10-year government bond for stocks, and the same country's stocks for bonds.
- Dollar-cost averaging Divide the amount into equal installments and buy the same amount at a regular interval, such as monthly. Money not yet invested is held as cash. This compares against buy and hold, which invests everything at the start (lump-sum investing).
- Moving-average filter Hold the full amount while the close is above its moving average over, for example, the past 200 trading days, and move to the step-aside asset when it falls below. The decision uses that day's close and the trade is made at the next trading day's close.
- Golden cross / death cross Hold while the short moving average is above the long one and step aside when it falls below. Trades are timed the same way as the moving-average filter.
- Time-series momentum On the first trading day of each month, compare the past 12 months' return up to the previous day with the return of the step-aside asset (the short-term interest rate for cash). Hold if it is higher; step aside if it is lower.
For what happened when Shannon's Demon was tested on about 100 years of US stocks and on Japanese stocks after the bubble burst, how much it earned and why it could not beat buy and hold, see “Does Shannon's Demon Make Money? Testing Rebalancing on 100 Years of US Stocks and 36 Years of Japanese Stocks”.
Reading the results
- Annualized return The constant yearly growth rate that produces the result over the whole period (the geometric mean, also known as CAGR).
- Annualized volatility The size of daily price moves scaled to one year (standard deviation). A larger value means a bumpier ride.
- Maximum drawdown The largest fall from a previous peak. The recovery date is the first day the value got back to that peak.
- Sharpe ratio The annualized return minus the short-term interest rate over the same period, divided by the annualized volatility. It shows how much was earned relative to the size of the price swings. If you set a fixed cash rate, that rate is subtracted instead.
Assumptions and caveats
Every trade is assumed to happen at that day's close, with no rounding to whole shares. Taxes are not included. If you rebalance or step aside in a taxable account, every sale of a gain is taxed and the result will be worse than shown here. The default trading cost is 0%, so entering a value close to your real commission and spread in the advanced settings shows how strategies that trade more often fall behind.
A rule that did well on past data will not necessarily work the same way in the future. In particular, if you tune settings such as the moving-average length while looking at the results, it becomes easy to pick a setting that merely happened to fit the past. This tool is meant to help you understand how investment strategies work; it does not recommend any particular trade or product.
Data and sources
The bundled data comes from publishers that make long-run daily data freely available. We are grateful to the people and institutions who have maintained and published this data for years for research and education. Every series is cumulative return including dividends or interest, converted to an index that starts at 100.
- US stocks The market return (Mkt-RF plus RF) from “Fama/French 3 Factors [Daily]” in the Data Library of Professor Kenneth R. French (Dartmouth College). It is the value-weighted return, including dividends, of all stocks listed on the NYSE, AMEX and NASDAQ, based on CRSP data. The US dollar cash rate is RF (the one-month US Treasury bill) from the same file. Copyright Eugene F. Fama and Kenneth R. French.
- Japanese stocks The market return (in US dollars) from “Japan 3 Factors [Daily]” in the same Data Library, converted to yen with the yen exchange rate (noon in New York) from the Federal Reserve's H.10 release. Because the Japanese market close and the exchange-rate time differ, daily values contain some noise.
- US 10-year Treasury Calculated from the 10-year constant-maturity yield in the Federal Reserve's H.15 Selected Interest Rates, assuming a 10-year bond at that yield is bought afresh every day, so both interest and price changes are included. It does not match the price of any specific bond or bond fund.
- Japan 10-year government bond and the yen short-term rate Created by processing the 10-year and 1-year yields in the Japanese Ministry of Finance's JGB interest rate data (“国債金利情報”, a Japanese-language page) (Public Data License, Version 1.0). The 10-year bond is calculated the same way as the US Treasury, and the 1-year rate is used as the interest on yen cash.
- Yen exchange rate The Federal Reserve's H.10 Foreign Exchange Rates (yen per dollar).
The bundled US and Japanese stock data runs to September 30, 2026, and the bond and exchange-rate data to late November 2026. The publisher updates the stock data roughly once a month. You can reproduce the data with scripts/build-backtest-data.cjs in the site's repository.
Why the S&P 500 and Nikkei 225 are not included
The S&P 500 and the Nikkei Stock Average (Nikkei 225) are owned by the companies that calculate them (S&P Dow Jones Indices and Nikkei Inc.), and redistributing their data requires permission. For example, FRED, the database of the Federal Reserve Bank of St. Louis, states that the S&P 500 data may not be reproduced without permission and provides only 10 years of daily data. For the Nikkei 225, downloading for research is allowed, but redistributing the data to third parties requires permission from Nikkei Inc. Because this tool places the data on the site where anyone can load it, these indexes are not bundled; instead it uses redistributable data that broadly represents the same markets.
The US total market covers more than the roughly 500 stocks in the S&P 500, but because large companies make up most of its value, its long-run movement is very similar to the S&P 500 with dividends. Likewise, the Japanese data is the whole market, closer to TOPIX (the Tokyo Stock Price Index) than to the Nikkei 225.
To test the S&P 500 or the Nikkei 225 itself
- Get the index's daily closing prices as a CSV from a source you are entitled to use: the index provider's official site, a broker's or financial data service's download feature, or FRED (the S&P 500 for the most recent 10 years, the Nikkei 225 from 1949, for research use only). Follow the source's terms of use.
- Choose “Load a CSV” as the asset and select the file. It can read files with the date (for example 2024-01-31) in the first column and the close in the second, or files with a header containing Date and Close (or Adj Close). Also select the CSV currency.
- The loaded data is used only inside your browser; it is neither sent nor stored.
The index values generally published are “price indexes” that do not include dividends. For the S&P 500, buy and hold will look worse by roughly 2% a year, the amount of the dividends. If you can obtain a “total return index” that includes dividends, use it to match the conditions of the bundled data.