Hello M,

the residual shares are because you aren't keeping the portfolio units fixed.

When you buy 100% of the equivalent S&P portfolio, that gives you (say) 3 equivalent S&P shares.

Then when you sell 50% of your portfolio, at that point, you should sell 50% of your equivalent portfolio, i.e. 1.5 shares of S&P equivalent shares.

The way you are doing it, the residual shares are the performance difference between the portfolio and S&P.

Cheers