Everything has a value. In times of extreme optimism shares become overvalued. In times of extreme pessimism, shares become undervalued. A savvy investor is able to exploit these extremes.
When a stock becomes overvalued, it may become more overvalued and stay overvalued for a long time. As long as the trend keeps going up, you should hold on to your stock. In a bullish scenario, man can become mad with enthusiasm. Thomas Edison said, " I can calculate the movements of the stars, but I can't calculate the madness of man."
In the bull market of 1971 to 1973, OCBC went up to a high of $50 per share. Stocks were then traded at 1000 shares per lot. That means if you buy 1 lot of OCBC, you have to pay $50,000 which was then equivalent to the cost of 2 terrace houses that could fetch an annual rental of $4000. As for 1 lot of OCBC, your annual dividend is only $100. Such was the madness of the stock market then.
The bubble in OCBC eventually burst. Within less than 3 months, if I am not mistaken, OCBC plummeted to $3 per share.
You will do well to remember that when shares are sold ex-hope and cum-despair, it is the time to buy. But when shares are at the other extreme, you should get ready to sell everything, and sell everything when the trend reverses.