Dr. Monzer Kahf, Scholar in Islamic Economics & Financial Expert, said,
This profit itself is an increase in the prices of stocks. Owning stocks means owning parts of the companies of these stocks and thereby an increase in these prices is in fact an increase in the value of the parts that you own. You notice that if the assets themselves are permissible (stocks are permissible to own and hold and trade), then their prices at the higher level must be permissible. But if the stocks are either not permissible, such as stocks of conventional banks, or mixed, such as stocks of computer producing companies that deal sometimes with interest, then the increase in their prices is either non permissible or mixed and need purification. But if the shares are permissible such as share of Islamic banks, then all the increase is Halal.
On the other hand, I have a great reservation on what you called investment in stocks. What is called investment in stocks may sometimes, rather most of the times, is in fact speculation. That is when you only intended to jump on price changes rather than having real interest in these companies.
In my opinion, speculation in shares or real estates or any other goods or currencies is difficult to call Halal. While it is permissible to use the increase in prices under the conditions mentioned above for Umrah, I suggest that one should better seek more pure and unsuspicious money for such a great worship, besides if did not make Hajj; yet I think you should give priority to Hajj before going on Umrah.