Deductions & credits

It does not matter if you withdrew your money of left it in your account. If the sale of securities caused loss or gain, it is taxable event.