When you are trading Bitcoins or digital currencies on an exchange, each sell order must be included in your capital gains calculations, even if you never withdrew the dollars to your own bank account.
If you received USD, another foreign currency, or even another digital currency, you have potential capital gains/losses. This includes any trading to other digital currencies, for example, buying ETH with BTC.