The stock market and the U.S.-China trade war or epidemic, there is a correlation, but not all stocks and these factors are positively correlated, some are negatively correlated, that is, will not be affected.
The trade war or epidemic will cause most stocks to fall, but there will be stocks that gain in this situation, for example, the U.S.-China trade war will lead to fewer orders for exporters, but correspondingly fewer imports due to bilateral sanctions. This provides opportunities for domestic producers to fill the gap left by reduced imports. Similarly while the epidemic had a big impact on society as a whole, pharmaceutical stocks did benefit from it, so they were up a lot for a while.
So it's important to distinguish between the performance of the overall market and the performance of individual stocks. Even in a bear market there will be stocks that go up a lot, but also in a bull market there will be stocks that go down the most. So the degree of difference between individual stocks is very large, and the overall index is what allows us to get a good measure of the overall performance of the capital markets.