The formula
net P&L = gross result − commission − swap − other fees
Uncontroversial as written. The trouble is entirely in what your file contains.
The edge case: which sign, and is it already included
Two things vary between exports and neither is visible from the profit column alone.
The sign of the fee columns. MetaTrader writes commission as a negative number: a $7 charge appears as -7.00. IBKR, Schwab and several crypto exchanges write the same charge as positive 7.00. Code that adds the column is correct for one group and doubles the cost in the wrong direction for the other.
Whether costs are already inside the result. cTrader and many generic broker CSVs can export a "Net P/L" column with charges already deducted; the same terminal can also export "Gross P/L" with them separate. Subtract fees from the first and every trade is understated by exactly one commission.
Neither mistake produces an error. Both produce a plausible equity curve that is quietly wrong by a predictable amount.
What our code does
The implementation lives in one file with no imports, so the same arithmetic runs on the server and in your browser:
- For live MetaTrader data, where commission and swap arrive as separate signed fields, they are added — the sign is already correct.
- For imported files, the fee column is subtracted as an absolute value:
gross − |fees|. This is deliberately defensive, because a CSV gives no guarantee about sign. - Where a parser reads a Net column, it records fees as zero rather than repeating them, so nothing is deducted twice.
That last decision has a visible consequence, and it is why our overtrading analyzer says "not listed separately in this file" rather than showing a fee total of zero. A zero there would read as "you trade for free", which is never true.
What it is good for
Every other metric. Expectancy, profit factor, average trade and drawdown are all built from per-trade results, so if the input is gross, every downstream number is optimistic by the size of your cost base — which for an active trader is the difference between a working method and a losing one.
How to check your own file
Open the export and look for the fee columns rather than the totals. If commission and swap are present as their own columns, your profit column is almost certainly gross. If the only money column is labelled net or realised, costs are probably already inside it.
If you are unsure, the free analyzers will tell you which way your file was read — they name the parser and say whether fees were listed separately.