---
title: "Capital-gains tax"
description: "Capital-gains tax is the tax charged on a realized gain when you sell a position at a profit. Which rate applies follows your tax residency."
canonical_url: "https://fincanva.com/docs/backtesting/capital-gains-tax"
last_updated: "2026-09-17"
md_url: "https://fincanva.com/docs/backtesting/capital-gains-tax.md"
---

# Capital-gains tax

Capital-gains tax is the tax charged on a **realized gain** — the profit you make when you sell a position for more than you paid for it. It applies only to gains you have actually locked in by closing a position, not to paper gains on holdings you still own. Crucially, it is charged on your **net** result rather than on each winning trade in isolation: realized losses are set against realized gains, and what is left over carries forward to later years. Fincanva can model the tax with two rates, a short-term and a long-term one chosen by how long the position was held, but whether that split exists at all is decided by your [tax residency](/docs/backtesting/tax-residency) — Italy taxes a realized gain at one rate however long it was held.

## How is capital-gains tax calculated?

Capital-gains tax is the applicable rate multiplied by the **taxable gain** — and the taxable gain is your realized gains after realized losses have been set against them, not each winning position on its own.

$$
\text{taxable gain} = \text{realized gains} - \text{realized losses set against them}
$$

$$
\text{tax} = \text{applicable rate} \times \text{taxable gain}
$$

where: **realized gains** and **realized losses** are the profits and losses locked in by positions closed during the year, and the losses that may be set against a gain include losses carried forward from earlier years, under the limits in the next section. The **applicable rate** is the short-term or the long-term rate, decided by your [tax residency](/docs/backtesting/tax-residency) and by how long the position was held. A year whose losses exceed its gains has a taxable gain of zero and carries the remainder forward; it is never a negative tax.

This is the difference that changes what a backtest shows you. A strategy that closed one position for +1,000 and another for −400 in the same year is taxed on 600, not on 1,000. Reading the rate against gross gains overstates the drag that taxes put on a strategy — often substantially, for a strategy that trades a lot.

Where the residency has both rates, a position sold after only a brief holding period meets the short-term rate and one held longer meets the long-term rate. The app labels the two fields "Short-term capital gains" and "Long-term capital gains".

## How long must a position be held to count as long-term?

**More than one year — more than 365 days between opening and closing the position.** A position held for exactly 365 days is still short-term; it has to pass the threshold, not merely reach it.

The threshold only does anything under the residencies that have two rates: **United States** and **Other**. Under **Italy** there is no short/long split at all, so the holding period does not change the rate — see [tax residency](/docs/backtesting/tax-residency) for which rates each residency starts from and which of them you can edit.

## What happens to a realized loss?

A realized loss reduces the gains you are taxed on, and any part of it you cannot use this year is carried forward. **How long it stays usable, and against what, depends on your residency** — and the Italian rules carry an asymmetry that is easy to be caught by.

**Under United States and Other residency:**

- A loss is first set against gains realized in the same year.
- Whatever is left over carries forward with **no time limit** — it stays available for as many years as the backtest runs.
- A carried loss **keeps its short-term or long-term character**: a carried short-term loss reduces short-term gains, and a carried long-term loss reduces long-term gains. It does not cross over.
- Fincanva does not model the annual deduction of net capital losses against ordinary income that US tax law allows. In a simulation, a loss is only ever useful against capital gains.

**Under Italy residency:**

- Losses carry forward for **five years**, after which an unused loss simply stops being available. The [tax regime](/docs/backtesting/tax-regime) you select decides when that window is counted from.
- There is a **single rate**, so there is no character to preserve — a carried loss reduces any compensable gain.
- **A gain on an ETF cannot be reduced by carried losses, but a loss on an ETF can be used to reduce other gains.** The asymmetry runs one way only.

### Why the Italian ETF rule matters to your results

If you are modelling a portfolio built mainly of ETFs under Italian residency, **your losses help you and your gains do not.** Every ETF gain is taxed in full, whatever losses you are carrying; every ETF loss still goes into the pool that reduces your other, non-ETF gains. A portfolio of nothing but ETFs therefore gets no benefit from netting at all on the gains side, even in a year that also produced large losses.

This applies to instruments Fincanva classifies as **ETFs**. Other exchange-traded products — ETNs, ETCs, closed-end funds — are treated as ordinary compensable instruments in the model, so their gains *can* be reduced by carried losses.

## Defaults in Fincanva

- The rates are percentages of the gain and are seeded from your [tax residency](/docs/backtesting/tax-residency), which is also what decides whether a short/long split exists at all — that page carries the per-residency table and says which fields you can still edit.
- Tax is charged only on realized gains, and only when taxes are switched on in your [simulation assumptions](/docs/backtesting/simulation-assumptions); with taxes off it is zero.
- For Italian residency the rates are set by tax law for the selected [tax regime](/docs/backtesting/tax-regime) and shown as "Auto-updated" rather than edited by hand.

## Worked example

A strategy closes two positions in the same year: one for a **1,000 gain**, held eighteen months, and one for a **400 loss**.

Under **United States** residency the loss is set against the gain first, so the taxable gain is 1,000 − 400 = **600**, not 1,000. The winner was held more than a year, so it is long-term and meets the 20% rate: 20% × 600 = **120 of tax**. Close the same winner at eleven months instead and nothing about the netting changes — the taxable gain is still 600 — but it is now short-term and meets the 35% rate: 35% × 600 = **210 of tax**. The holding period moved the bill by 90 on an unchanged pair of trades.

Now give the strategy a **1,400 loss** instead of a 400 one. Losses exceed gains, so the taxable gain is zero and the tax is **0**. The unused 400 of loss carries forward as a long-term loss, still available against long-term gains in any later year of the run.

Run the same pair under **Italy** residency and two things change. The single 26% rate applies whatever the holding period was, so both versions give 26% × 600 = **156 of tax**. And if the winner was an **ETF**, the netting does not happen on that side at all: the 1,000 ETF gain is taxed in full, 26% × 1,000 = **260 of tax**, while the 400 loss is not wasted — it stays available against any non-ETF gains the strategy made. Same two trades, same rate, 104 more tax, purely because of what the winner was.

*These figures describe the tax base Fincanva models in a simulation, not tax advice for your own situation — see [Is this financial advice?](/docs/investing-theory/is-this-financial-advice#is-this-financial-advice).*
