Would it be a good idea to invest long term in a stock but buy in the morning and sell at the close every day? This can reduce the risk of an economic crisis affecting my portfolio. I would hold it overnight if there was an earnings report etc.
An economic crisis can occur during the day too!
So this doesn't sound like a great idea for several reasons, the first one of which is transaction fees. Secondly, tax obligations: any profit at the end of the day is taxable, and so over time you can potentially accumulate a lot of taxes on stock that didn't appreciate in value a lot.
Under your plan not only will you have transactions costs every day, and capital gains issues every day, but you will miss both the good and the bad of the changes that take place when the market is closed.
Sometimes those events that you want to neutralize because they take place at night or on weekends are the events that you want to capture. If the price jumps overnight then you will end up buying fewer shares the next morning. Those are gains that you can't get back.
Besides the already mentioned excellent points about transaction fees and tax obligations, you're missing the whole point of long term investing: it ignores short term crises like Trump tariffs and the Turkey crisis.
Buying in the morning and selling in the afternoon is... day trading. And ignores after hours trading and world markets.