Non-residents do not pay capital against taxes on sell of shares unless those shares were were purchased or acquired as a result of your employment effectively connected with the U.S. or a U.S. company.
You do need to file a form 1040NR.
The tax treaties between the two countries requires that U.S. sourced income is taxed first in the U.S. and then taxed in your country, where your country gives you credit for taxes paid to the U.S.
However the clauses in the tax treaty provide for a different approach at the discretion of the two taxing authorities. What this means is, you need to file the 1040NR and pay attention to the last page where you claim tax benefits.
Provide a cover letter explaining the circumstances of how you paid taxes to your home country on this income.
The IRS can accept those terms; or they may insist on you paying the U.S. TAX and reimburse you any over payment on that basis. If they reimburse based on a tax obligation to the U.S. without regard to taxes paid to your home country first, then you will be forced to seek reimbursement from your home country for the resultant overpayment of taxes. (double tax).
You ask: is there no way to send a W-8BEN or equivalent to the IRS now?
My response: Yes, you can send one now, but it will not do anything for you and is redundent. The reason it is redundant is that the 1040-NR has a section for claiming tax treaty benefits.
The W-8BEN is a document that allows you to cliam tax treaty benefits befor withholding.
When you file the form 1040-NR you will claim tax treaty benefits on the last page, and if you are not nobligated for any tax according to the terms, then the IRS will refund it all. If you are entitled to a beneficial rate, then you will only have to pay the beneficial rate (genrally 15%), and you would be refunded the balance.
I understand, that the 1040NR is a complicated document.
YOU ASK: CAn I help or make a referrel tgo reliable partners.
My answer: I am unable by the rules on this site to contact you offsite or to have a client relationship with you. However, I can refer you to a couple of people with whom I am familiar with thier work.
1. This company is set up for U.S. expats, but can do the Non-resident return. http://www.visiontaxservice.net/
2. This is the Women's Venture Fund who has tax consultants who are competent at completing the 1040NR. email@example.com.
Of course the big boys, that is PWC for example can do it also, but they are expensive. The two referrels I made will do the return for a modest price.