Skip to content
thecalculatorstudio

DCA Backtest Calculator: Replay Dollar-Cost Averaging on Your Prices

Paste one price for each purchase date, set the amount you buy each time and any fee. You will see the units bought, the average cost, the value at the last price, and how a lump sum at the first price compares.

Last reviewed

Paste the price of the asset at each purchase date, for example the monthly closing prices from your own data source. The five prices shown are an example, not market data.

$
%

Value at the last price

$650.00

$150.00 gain (+30.00%) on $500.00 spent over 5 periods

Units bought
65.0000
Average cost per unit
$7.6923
Plain average of the prices
$8.2000
Lowest and highest price
$5.00 to $10.00
Lump sum at the first price
$500.00 (+0.00%)
Periodic buying versus lump sum
+$150.00

This replays the prices you entered. It is not a forecast, and past prices do not predict future ones. Taxes and the timing of your real purchases are not included. This is not financial advice.

Replaying dollar-cost averaging on real prices

Dollar-cost averaging means investing a fixed amount at regular intervals, whatever the price is, instead of investing everything at once. This calculator replays that on a list of prices you paste in, one for each purchase date. It shows how many units you would have bought, what each cost on average, what the holding is worth at the last price, and how that compares with putting the whole amount in at the first price.

It holds no market data. You bring the prices, from a data source you trust, so the answer is about your list and nothing else. The five prices on this page are made up to show the arithmetic.

The calculation

  • Units in one period = amount × (1 − fee ÷ 100) ÷ price in that period.
  • Total units = the sum over all periods.
  • Total spent = amount × number of periods.
  • Average cost per unit = total spent ÷ total units.
  • Value = total units × the last price, and gain = value − total spent.
  • Lump sum = total spent × (1 − fee ÷ 100) ÷ the first price, valued at the last price.

The average cost is always at or below the plain average of the prices. The same amount buys more units when the price is low and fewer when it is high, so you buy more at the low prices than at the high ones.

Worked examples

A price that dips and recovers. The prices are 10, 8, 5, 8, 10, you buy 100 each period, and there is no fee.

  • Units: 10 + 12.5 + 20 + 12.5 + 10 = 65.
  • Spent: 500. Average cost: 500 ÷ 65 = 7.6923, against a plain average price of 8.2.
  • Value at the last price of 10: 65 × 10 = 650, a gain of 150, or 30%.
  • Lump sum: 500 ÷ 10 = 50 units, worth 500, so 0%. Periodic buying ends 150 ahead.

A price that only rises. The prices are 10, 11, 12, 13 and you buy 100 each period.

  • Units: 35.11655. Spent: 400. Average cost: 11.3906, against a plain average of 11.5.
  • Value at 13: 456.52, a gain of 56.52, or 14.13%.
  • Lump sum: 400 ÷ 10 = 40 units, worth 520, which is 30%. Here the lump sum ends 63.48 ahead.

A fee. The same dip-and-recovery prices with a 1% fee on each purchase give 64.35 units, a value of 643.50 and a gain of 143.50, or 28.7%. The lump sum pays the fee once and ends at 495, which is a 1% loss.

The three examples in a table

Prices Spent Value at the last price Gain Lump sum value
10, 8, 5, 8, 10 500 650.00 30% 500.00
10, 11, 12, 13 400 456.52 14.13% 520.00
10, 8, 5, 8, 10 with a 1% fee 500 643.50 28.7% 495.00

Reading the result

  • Neither method wins by rule. When the price rises throughout, putting everything in early does better. When it dips, buying over time does better. Which one happened depends on the prices.
  • Past prices are not a forecast. A backtest on one period tells you what would have happened on that period, nothing more.
  • Match your real dates. Use the price on the days you would really buy, and the same time step each time.
  • Fees and taxes. The fee box covers a fee on each purchase. Taxes, spreads and the timing of real orders are not included.

Related tools: the average return calculator, the stock average calculator, the investment calculator and the ROI calculator.

Frequently asked questions

What is dollar-cost averaging?

It is investing a fixed amount at regular intervals, whatever the price, instead of investing everything at once. The same amount buys more units when the price is low and fewer when it is high, so the average cost per unit ends up below the plain average price.

Where do I get the prices?

From any data source you trust, such as a broker, an exchange or a chart site that lets you see closing prices. This page holds no market data, so the result is only about the list you paste in. One price per line, oldest first.

Is dollar-cost averaging better than a lump sum?

Neither wins by rule. If the price rises throughout, investing everything early does better. If it falls or dips first, buying over time does better. A backtest only shows which happened on the prices you used, not which will happen.

Which price is the holding valued at?

The last price in your list, which is also the price of the last purchase. The last period buys at that price and the holding is valued at it straight away, so end your list on the date you want to value it.

How is the fee handled?

The fee percentage is taken from every purchase, so each period buys amount × (1 − fee) ÷ price. The lump sum comparison pays the fee once on the whole amount. Total spent includes the fees, since you pay the full amount.

Is this financial advice?

No. It replays prices you give it and does arithmetic. Past prices do not predict future ones, and taxes and the timing of real orders are not included. Check your own situation, or ask a licensed adviser, before investing.

Related calculators

Sources

This tool is for information only and is not financial advice. Figures are estimates, confirm anything you act on with your lender or a qualified adviser.