For the purposes of social security contributions and income tax, losses incurred a year are attributable to capital gains of the same nature in the same year and ten following years, regardless of the annual assignments carried out by the tax household in the year under review.
example:

In 2016 you did less value 2000, by 2017 you did 20,000 euros of transfers with a value of 1,500 euros. You can blame the loss on the capital gain realised by 2017, within the limits of the latter in 2016. No tax will be applied and the meter of the losses carried forward will be €500.