It is easier to buy a stock than to sell it. People often talk about how I bought GameStop $GME at $2-$4 in 2019 but what they don't talk about is how I sold at $400. How did I know that it was time to sell? There are other instances when I had to sell but I didn't. For example, I was making a nice profit on DouYu $DOYU at some point.
It is important that you keep an investment diary. Every move you made in the market, you have to write it down. Why did you buy? If you don't know why did you buy a stock, you will not know if you have to sell it. The main reason why you will invest in a stock is if it is undervalued after a margin of safety.
Therefore, it seems that the main reason to sell is if the stock is overvalued. What if it keeps going higher? Mr. Market is never right about the price of the stock, therefore, it makes sense to sell at a premium of the intrinsic value.
You also need to look at other stocks in your portfolio. If your investments are too correlated with each other, you better sell. For example, I sold most of my shares of Apple $AAPL when I started buying Skyworks Solutions $SWKS . You also need to look at opportunity cost. Is the money better invested in something else?
You may also consider selling a stock if the fundamentals change or if you don't believe in the management anymore.