Let's say I'm a U.S citizen and have money in a brokerage account at a U.S institution, but I have moved to Germany. Let's imagine that this money generates capital gains. Assuming that I have to pay taxes on these gains in Germany, how are those gains treated by the U.S tax code?
What if the gains are generated at an institution in Germany? How does the U.S tax code treat the gains then?