The "Cost Basis" for a particular investment changes when transferring between investment accounts. I think this only happens when multiple lots have been purchased, then a partial lot sold before the transfer. I think when the partial lot is sold, the "cost basis" used, and thus the "realized gain" calculation, is based on the total cost of the multiple lots divided by the total number of units. This is an incorrect calculation of the "realized gain", since only a portion of the first lot was sold. It also leaves an incorrect "amount invested" for that particular asset. This is compounded when all remaining shares are transferred to a different investment account because they are removed using the "incorrect cost basis", but added to the new account in lots, using the original correct unit prices. Thus by transferring shares between accounts the cost basis of the shares is changed.
Is there any way to get around this? Because of it, the P&L statement net income plus the previous year retained earnings do NOT equal the new year retained earnings. As well, the "realized gains" are incorrect in the year the sale was actually made.