The tax consequences of selling real estate may not be what you expect. For example, depreciation recapture can turn what looks like a large loss into a smaller one, or even a gain. If your real estate sale does indeed produce the capital loss you anticipate, it can be used to offset capital gain from selling stocks.
Be aware that unused capital losses carry forward but not back. If you sell the stocks now, and for some reason fail to complete a sale of the real estate by the end of the year, you’ll pay tax on the stock gains and have a potentially unusable capital loss on the later sale of the real estate.