The relentless gush of cash into the stock market is sending a powerful "sell" signal, according to a Bank of America Merrill Lynch gauge that has been a reliable indicator in the past.

Investors poured $33.2 billion into stock-based funds through the week ended Wednesday, BofAML said in a report. That's a record both for total flows and as well as for active funds, which alone pulled in $12.2 billion.

By comparison, equity funds across all classes took in a net $278 billion for all of 2017, according to Morningstar, meaning that last week alone equated to 12 percent of flows for the entire previous year.

The week continued a trend that has seen money rush into stocks as major averages climb to new records. The Dow Jones industrial average is up 7 percent year to date.

While the inflows have helped push the market higher, they also can be seen as a contrary indicator when they flash signs of excess. BofAML uses a proprietary "Bull & Bear" indicator that gauges when inflows or outflows point to investors moving too far to either side.

The current reading on the indicator of 7.9 is the most bullish since a reading above 8 in March 2013 — a sell signal. Michael Hartnett, BofAML's chief investment strategist, said the Bull & Bear indicator has shown 11 previous sell signals since the firm started tracking it in 2002 and has been correct each time.

In the near term, around February and March, that suggests a technical pullback for the to 2,686, which would represent a drop of close to 6 percent, Hartnett said.

The enthusiasm has not been unique to the U.S., whose equity markets brought in $7 billion of fresh cash.

Emerging markets attracted $8.1 billion in new flows, Europe brought in $4.6 billion and Japan saw $3.4 billion. That comes as 98 percent of global markets are trading above their 50- and 200-day moving averages, both classic signs of overbought markets.

FWIW, the Dow is the most overbought since ... 1904 (not a typo)

Stock-based funds overall have brought in just shy of $77 billion in 2018, with the lion's share of $59.2 billion going to passively focused exchange-traded funds.

However, investors continue to hedge, giving about $32 billion to bonds, while last week's $1.5 billion flow into gold funds was the highest in 50 weeks.

WATCH: Trump predicts stocks would have fallen 50 percent if Hillary Clinton was elected.