Good question and quite often they are no good answers to the good questions.
I’ll just share a perspective instead of offering you a formula to figure out the right price to enter a stock. (If I knew the formula I would probably have a bestseller on my hand.)
In principle your idea of looking at valuations is right.
To quote Mr Buffett, margin of safety, difference between value of a company and its stock price, should be a key factor in influencing your decision to invest. If you know how to value a company you can easily figure out whether a stock is undervalued, fairly priced, perfectly priced, overpriced or insanely overpriced.
But valuing a company is never that easy. Valuation metrics might tell you how a company is currently valued relative to its financial performance till present day but whether it is good or bad depends on what market thinks is going to happen to the company in future.
A company growing its earning at 30% year on year may be seen as fairly valued even at a p/e of 60 if market believes that earning performance can be sustained. Conversely, a company with the similar earning performance might be seen as overvalued even at a lower multiples if market doesn’t believe in its long term growth prospects or the sector company operates in.
This is what then happens. Since no one really can see the future, investors try to build a narrative around a stock based on different data points they have about the sector and the company, management commentary and company’s ability to execute on their promises among a host of other factors. We start seeing big moves in stock prices when continued pushing of narrative and sustained price momentum attracts more and more buyers to the stock.
If you saw RVNL or SJVN stocks going up despite unflattering quarterly numbers it could be that market has heavily discounted a lot of exciting future into the current price or exploited the euphoria surrounding the stock.
So if you are not comfortable betting on a stock purely based on the narrative or don’t have time for excessive research to validate that narrative, it is better to find the businesses where you are certain about a company’s long term prospects based on their past performance and don’t find price scary.
You may not perfectly time the entry price and might enter a stock at higher levels but in the long run you will still make money (of course with some luck).