Capital Gains

I recently moved to Portugal. I will become a Tax Resident sometime in the first quarter of 2024. Capital Gains on investments (not real estate) are taxed at 27% in Portugal. I have unrealized Capital Gains  in an investment portfolio. My idea is to liquidate just enough of this portfolio to stay under the $583,750 income threshold in 2024, for Married filing Jointly. This will allow me to pay 15% Capital Gains tax + 3.8% Net Investment Income tax in the US and nothing in Portugal.  I have minimal other income currently. I am not working and will only be getting interest income. As long as I keep the total under the $583,750 + standard deduction of $29,200, I am thinking I should be all set. Am I missing something?

 

Thanks for weighing in.