resetting cost basis / saving tax for investments when moving to Japan?

I'm planning to move to Japan long-term and right now I'm holding a bunch of US stocks with some capital gains. I'm neither US or JP citizen.

Say I'm not eligible for exit tax (less than 8 yrs in holding green card), technically I could

• ⁠Move to Japan and give up green card say on Jan.1 and stay in Japan for the year
• ⁠Sell my US investments as soon as I move to Japan
⁠1. ⁠I don't owe US tax as I'll be non-US-resident by then
⁠2. ⁠I won't owe JP tax, as I'll be NPR (non-permanent-resident) in JP by then.

So technically I won't be liable for any tax for these existing assets?

Source https://wiki.japanfinance.org/tax/income/#income-that-is-neither-japan-source-nor-foreign-source: "Since April 1 2017, if you acquire securities outside of Japan while you are NPR status and you sell those securities while NPR status, income from the sale is taxable in Japan even without a remittance into Japan. Capital gains from securities acquired while not a tax resident of Japan but sold while NPR are not taxable in Japan unless you remit money into Japan."

by smilenceyu