That’s a million dollar question, isn’t it? I don’t have an answer to that just more questions that can help you answer it yourself.
What I have presented in this thread is a stock selection strategy and what you are asking is asset allocation strategy.
Theoretically, you can value each stock using standard valuation models, derive expected return, risk and correlations and use mean variance optimization to decide asset allocation between stocks and other risky and risk free assets. Institutions do that and it is the most widely used and best method of asset allocation. But it does require accurate inputs and getting those right isn’t always easy. Individuals decide their asset allocation based on changes in sentiments and headlines and that is the worst way to decide your allocation.
If you are young and plan on investing for a long time, just ignore market and focus on gaining an edge and keep investing as in the long term markets almost always go up. Also, if your current income is large enough to meet your current expenses, it shouldn’t matter to you if market drop 50%. I had been following this strategy earlier and in hindsight I wish had followed it rigorously.
Even if you are retired and sell part of your portfolio for your daily expenses, you can create a bear market reserve consisting of liquid funds which you can liquidate during bear markets instead of selling undervalued stocks. Invest rest of the portfolio in equities. Most bear market bottoms where stocks are undervalued do not last longer than 12-18 months so you can decide how big a reserve you should create. I am slowing moving towards this strategy. When should you start liquidating your reserves and when should you start rebuilding it again is a judgement call but it is lot easier than timing market tops and bottoms.
I have met a few people who invest because they want to call their own shots and enjoy being proven right. Their objective is to satisfy their inner desire to make their own decisions and be proven right and not necessarily build long term wealth. Some of them try and time the market regularly so they are right few times or buy a large number of stocks so they are right about something all the time so they always have something to brag about. They don’t talk about their long term performance but only about their process. If you fall under this category, you don’t have to worry about allocation and selection.
Another rather simplistic yet effective strategy I have used in the past is to look at trend vs actual value of market index to decide allocation. Chart presented here compares where market is current trading and what the trend value (a simple ordinary least squares regression line) is along with allocation zones. I did use and continue to refer to this chart to decide my allocation.
Finally, Calculating intrinsic value is logically the correct way to decide allocation. Valuation is a combination of art and science and too much of either is not going to work. I have presented the valuation model that I use and combine it with insights gained from reading annual reports, this forum, meetings etc to decide intrinsic value. Based on this model, if I find something that is undervalued I buy it irrespective of how expensive the market is. Similarly, if a stock in portfolio becomes expensive I sell it again irrespective of how expensive or cheap overall market it. A strong sense of intrinsic value is needed if you want to follow this strategy. You have to hold on to your notion of value during market extremes and you have to be right about your calculations.
As you can see, over the over the years I have changed my allocation strategy and it is still evolving and likely to change in future as well. Your choice can depend on what you are comfortable with as I think sticking to a strategy is more important than having the most accurate strategy.