Sums a run's closed trades per calendar year and instrument: gross gains, losses, commission, swap and net, as CSV and Markdown, in EUR when ECB rates are cached.
Not tax advice: a backtest is hypothetical, and this exporter only adds up its trades. Ask a tax adviser how real trading results are to be declared.
A trade counts in the year it was closed, on the clock of the time zone you set, so a trade closed at 23:30 UTC on 31 December counts in the next year in Berlin. Per year and instrument the report lists the number of trades (won and lost), the gross gains (trades that made money before costs), the gross losses, the commission paid, the swap (a credit is positive) and the net result: net = gross gains + gross losses - commission + swap, which is the sum of the trades' own net figures.
The amounts are in the result's currency, which is the instrument's quote currency (USD for EURUSD); the engine converts nothing. With the ECB reference rates plugin (ecb_fx_reference) switched on and its data fetched, the report adds every amount in EUR: each trade at the euro reference rate known on the day it closed, read from the feed ecb_eur plus the currency (ecb_eurusd holds USD per 1 EUR). Without that feed, or when it does not cover every closing day, the report stays in the result's currency and says why in its first lines.
Configuration
Field
Type
Default
Description
convertToEurAdd EUR with ECB rates
boolean
true
Add every amount in EUR with the ECB reference rates, when their feed is on this machine. Off keeps the report in the result's currency.
fileNameFile name
string
"realised_pnl"
The start of both file names; the instrument and the run's seed are added, the files end in .csv and .md.
timeZoneTime zone for the year boundary
string
"Europe/Berlin"
The time zone whose midnight separates the years, as an IANA name like Europe/Berlin or UTC.
Use it in a strategy
Not called from a strategy: after a run, choose it in the result's export menu. Exports are part of the plans that include CSV export. For EUR, switch on ecb_fx_reference and run once with "Fetch external data (news and plugin feeds)" ticked, so its feed is on this machine.
What it provides
realised_pnl_<instrument>_<seed>.csvFile
One row per year and instrument. Two lines starting with # come first (the disclaimer and the currency basis); pandas reads it with comment="#". The _eur columns are empty when nothing was converted.
realised_pnl_<instrument>_<seed>.mdFile
The same as a Markdown report: the disclaimer, the currency basis, a table per year and a table per year and instrument.
Limits
Not tax advice and not a tax report. It does not know your country's rules, loss offsetting, allowances or the tax categories of CFDs, futures or forex.
The trades are those of a hypothetical backtest. A trade the engine closed at the end of the data counts in the year the data ended.
EUR only through the ECB reference rates, one a day: a trade uses the last rate published before the day it closed, which on a Monday is Friday's.