Investors are piling so much money into stocks that they’ll be ripe for shorting as risks of sticky inflation and hawkish central banks grip markets in the second half of the year, Bank of America Corp. strategists say.

Global equity funds have seen inflows of nearly $70 billion in the past seven weeks, the bank wrote in a note citing EPFR Global data. Market optimism that the economy will run neither too hot nor too cold is unlikely to last, according to BofA strategist Michael Hartnett.

“Goldilocks rules risk assets for now,” but the second half is likely to bring higher consumer-price inflation, policy tightening and savings, he wrote. “We’ll look to short risk assets in late-August or early-September and note a big, fat secular trading range remains the base case.”

Hartnett was correctly bearish on stocks last year but his pessimistic view has clashed with the S&P 500 Index’s 17% rally so far.

US equities have rallied this week as signs of cooling inflation raised bets that the Federal Reserve would end its rate hikes soon. That boosted tech stocks in particular, as higher interest rates mean a bigger discount for the present value of future profits in the sector.

While Wall Street forecasters including Hartnett and Morgan Stanley strategist Michael Wilson are bearish on the stocks outlook for the rest of the year, investors have mostly shrugged off risks so far.

Focus now turns to the second-quarter earnings season, which kicks off today with reports from big US banks including JPMorgan Chase & Co. and Citigroup Inc.

Other highlights from the note:

• Global stock funds have inflows of $11.6 billion, led by US funds, in the week through July 12.
• Bond funds have additions of $12.1 billion, while $17.6 billion leaves cash funds.
• European equity funds see redemptions for an 18th week at $3 billion.
• Tech has the biggest inflows among sectors, while health care and energy see the biggest outflows.

This article was provided by Bloomberg News.