How backtests flatter: lots and fills
Model credit: InvestAnswers (IA) (opens in a new tab). He names bar-close fills and FIFO / LIFO exits: bar close at 3:02 (opens in a new tab) and FIFO/LIFO at 5:19 (opens in a new tab) (2026-01-29). Our own worked model on the public conventions.
Free, no sign-up, no catch. No email, no account, no cookies.
Hypothetical model, not advice; not tax advice.
Which lots does a sell close?
Type your buy lots oldest first, then the units you sell and the prices. FIFO sells the oldest lots; LIFO sells the newest; pro-rata sells the same fraction of every lot. Fees are a percent of each trade's notional, with each buy fee carried into that lot's cost.
Lot results by method
| Metric | FIFO | LIFO | Pro-rata |
|---|---|---|---|
| Cost of units sold | |||
| Proceeds | |||
| Realized P&L | |||
| Realized ROI | |||
| Cost of units left | |||
| Open P&L at the mark | |||
| Total P&L |
Signal-bar fill vs next-bar fill
A signal is only known at the close. A backtest that fills at the signal bar's own open assumes a trade made before the signal existed. The realistic fill is the next open.
Enter the three prices to see the gap.
Our convention
- Decide at the close. The signal is what the closed bar shows, not what the bar looked like while it was forming.
- Fill at the next open or the published price. Never at the signal bar's own open.
- Fees in. Every buy fee goes into its lot's cost; the sell pays its own fee.
- Report open and closed P&L. Closed-trade ROI alone hides the position that is still open.
- Report results by regime. A single blended number can hide when a rule worked.
- Never backfill. A rule is fixed before the outcome; later edits are a new test.
Our live hypothetical record, with its closed trades and open positions, lives on the track record page.
Everything runs in this browser tab. There is no fetch, no cookie and no storage; the address bar keeps your inputs so a reload restores the same numbers.