Setting position size based on closed equity in backtest

Hi all, I've been using pos size as % of (open) equity for a trend following system, but since this type of strategy typically have few but large winners sometimes the open profit is huge. I would like to backtest the strategy with pos size based on closed equity ie. 'money in the bank' so to speak.
How would you suggest doing this?

You would need to do this using a mid or low level CBT.

Thanks @mradtke, I suspected as much. Will have to read up on that.
Would have been nice if that option was available as an option though.
What I'm thinking is to test variations e.g. closed equity + entry price for open position or closed equity + half of open profits.