A backtest runs on a real price path
A backtest differs from the linear model: it takes real daily closes over a period and buys a fixed amount on each date at your chosen frequency (daily, weekly or monthly), accumulating units day by day.
The result therefore contains real highs and lows, and the same settings produce different numbers in different date ranges.
Formulas
amount per period × actual buysΣ(amount per period ÷ price at that period)total invested ÷ units accumulatedunits accumulated × final pricefinal value − total investedmax(1 − value on a day ÷ prior peak value)Worked example (4 observations, recompute it yourself)
500 USDT per period, 4 periods, prices of 40,000 / 50,000 / 25,000 / 50,000 USDT:
Units per period = 0.0125 / 0.0100 / 0.0200 / 0.0100, so units total 0.0525 and total invested = 2,000 USDT.
Average cost = 2,000 ÷ 0.0525 ≈ 38,095.24 USDT; final value = 0.0525 × 50,000 = 2,625 USDT; P&L = +625 USDT, a return of +31.25%.
How the drawdown figure arises
The peak portfolio value occurs at the second observation: 0.0225 × 50,000 = 1,125 USDT. By the third observation the price is back at 25,000, and after that buy the value is 0.0425 × 25,000 = 1,062.50 USDT.
Drawdown = 1 − 1,062.50 ÷ 1,125 = 5.56%. Measured across these four observations only, maximum drawdown is about −5.56%.
A live backtest measures value every day, so moves between those points are captured too and the drawdown is usually larger than an observation-only figure.
Reading each field
- Buys and total invested: how many purchases happened in the window and how much went in — a check that your settings took effect.
- Units and average cost: average cost = total invested ÷ units, pulled down by the cheaper buys.
- Final value and P&L: final value = units × final price, and P&L = final value − total invested.
- Return: P&L ÷ total invested, independent of holding length, so do not compare it directly against other periods.
- Maximum drawdown: the deepest fall from a peak value, a measure of the ride along the way rather than the final result.
Notes
Historical results describe what a past price path produced. They say nothing about the future and are not buy/sell advice.
The backtest excludes fees, slippage and withdrawal costs, so real DCA costs slightly more than the reported result.
Different windows and frequencies produce different average costs and drawdowns. Keep the window, frequency and per-period amount consistent when comparing.
FAQ
Why is the backtest return different from the linear model?
The linear model interpolates evenly between two prices to explain the bookkeeping. A backtest uses real daily closes, so the actual path of highs and lows changes the buy points.
Is drawdown measured against capital or against value?
Against value. It records the largest percentage fall in portfolio value from a prior peak, which is not the same as the unrealised loss against capital invested.
Can a backtest predict returns?
No. It is an arithmetic replay of historical data — it answers what a past path produced, not what comes next.