I sold a covered call for $1000. If I buy it back for $5000 before the expiration date, will the $4000 considered a short term loss and will it offset my short term gain and long term gain? I do not mind keeping the underlying stock.
If you buy the call back before expiration, the $4,000 will be considered a short term loss regardless of the length of time that the option position was open (short sales are treated as short-term even if they were open for more than one year).
It might have been a good idea to either cover the short call before it appreciated so much or to have rolled it up and out for a small loss or even a credit but as it is, I am not a fan of realizing option losses while carrying paper gains because the market has a perverse way of making you pay for that. I would sooner adjust the position, book gains and carry paper losses.