Investment strategy backtest
Specify a historical price CSV, comparison period, and total budget to compare lump-sum purchases, monthly installments, and moving average trading. Check asset value and price trends and summaries by strategy, and download asset history and trade details as CSV.
What you can do
Compare 3 strategies with the same budget
Compare lump-sum purchase, monthly installments and a moving-average strategy using the same price data and total budget.
Review trends alongside the numbers
Switch between asset value and price charts to compare values by date, final amounts and drawdowns.
Get calculation details as CSV
Review prices, asset value trends, trade dates, quantities, fees and remaining cash in CSV.
How to use
Load price CSV
Choose a CSV containing Date and Close, or Date and Adj Close. If there is an Adj Close column, its adjusted closing prices take priority.
Set the period and total budget
Enter the start date, end date and total budget for comparison. Currency is a display unit matched to the CSV prices; no exchange rate conversion is performed.
Check conditions and compare
Adjust fees and the number of moving-average observations if needed, then press Compare.
Review and save results
Use the charts and date slider to review trends and compare the summaries of the 3 strategies. Save any details you need as CSV.
Useful when
See the difference between lump-sum and installment purchases
Compare past trends when the same total budget is spent all at once versus spread across the months with data.
Check the effects of trading rules
Change the number of moving-average observations to examine how holding periods and periods waiting in cash affect the results.
Prices and calculation assumptions used in the comparison
The 3 strategies start with the same cash
Monthly installments do not add funds each month. The initial total budget is divided equally by the number of months with data in the selected period, and purchases occur on the first recorded date of each month. Cash waiting to be invested is also included in asset value.
Prices used for moving-average decisions
Using the selected price column, compares the average of the immediately preceding specified number of observations with the previous recorded date's price. Buys when that previous price is above the average; holds cash when it is below or equal to the average. Trades use the price on the next recorded date.
Adjusted closing prices and dividends
Uses Adj Close prices when available. Stock split and dividend adjustments are reflected only to the extent included in the CSV prices; dividends are not added or reinvested separately.
Fees and sales on the final day
The same fee rate is used for every purchase and sale. No new purchases occur on the final day, and all holdings are sold. The final amount is cash after deducting the selling fee.
Period return and maximum drawdown
Period return is the profit or loss over the entire period relative to the total budget, not an annualized rate. Maximum drawdown is the largest percentage decline from the highest asset value reached up to that point.
What this calculation excludes
Assumes 0 interest on uninvested cash and allows fractional quantities to be purchased. Taxes and differences from actual execution prices are excluded. This is a calculation using past prices and does not indicate future results.
Frequently asked questions
What kind of CSV can I use?
A CSV containing Date and Close columns, or Date and Adj Close columns. Dates must be YYYY-MM-DD, and prices must be numbers greater than 0. Up to 2 MiB and 25,000 rows, with at least 2 price records required. Data with duplicate dates cannot be loaded.
Does changing currency perform exchange rate conversion?
No. Currency is the display unit for prices and the total budget. Use the same unit in the CSV and for the total budget.
Are funds added each month for the monthly installment strategy?
No funds are added. Purchases stay within the initial total budget, and unused funds remain as cash. On the final day, only sales are made, with no purchases.
Why are there 0 moving-average trades?
Funds are held as cash until there are enough past prices for the specified observation count. Even when there are enough observations, no trades occur unless the purchase conditions are met.
Why does the calculation period differ from the dates I specified?
Only dates recorded in the CSV within the specified range are used. If you specify a date with no price, such as a holiday, the results show the first and last recorded dates actually used in the calculation.
The results disappeared when I changed the settings.
Changing conditions or the CSV clears the results to prevent accidental use of results from previous conditions. Compare again to calculate using the current conditions.
Input and results
- Input
- One price CSV. Date and Close, or Adj Close. Up to 2 MiB and 25,000 rows.
- Calculation
- Lump-sum purchase, monthly installments and a moving-average strategy. Compare using one price series and the same total budget.
- Results
- Asset value history CSV and trade details CSV. Chart points may be thinned for display, but the CSV includes all calculated records.