as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
selling a stock for gain to offset other stock loss
user
long term gains are taxed at 15% maximum.  losses, up to the $3k/yr you cited, can offset ordinary income, so 25% or higher, depending on your income. better to take the loss that way. with my usual disclaimer: do not let the tax tail wag the investing dog.
assistant