Handling taxes (capital gains / losses)

Hi all,

Is there any way to simulate the handling of taxes in backtesting?

Our legislation requires brokers to automatically deduct 25% capital gains tax from each winning trade.
Obviously this has a significant impact on compounding, so it can really make or break strategies.

A possible implementation of this could be via only partial re-investment of gains from a trade. But I can't seem to find a way to adjust the available cash between trades.

Any help is greatly appreciated.
Thanks a lot!
Dirk

If you're from Germany or the Netherlands, that's the way it's done. There are so many variables in this game, it's hard to advise.
Are you sure you deduct the taxes on a trade by trade basis?

If there is a way to keep the money, re-invest the money, then deduct taxes once a year for tax purposes, you come out ahead... I.e. if my broker is non-Germany based, it can be handled this way.

Programming-wise, I haven't seen a template, but I would start using a custom backtest procedure.

You would need to use mid-level custom backtest and subtract 25% of profit from positions that were closed given bar.

Thanks to both of you for your replies. I checked the documentation for the custom backtester already -- but obviously not close enough. I'll go re-read then :wink:
Dirk