How the Gain and %Gain is calculated in the investment portfolio?
It calculates the cost of purchase for shares currently owned (adding all buy transactions) and compares it to the current market value. If you sold any shares in the meantime, they are not accounted for regardless of gain/loss you may have had on them.