Wall Street could witness a sell-off in the next few months if three decades of history are any indicator, closely watched trader Art Cashin warned Wednesday.
"To prove that I'm probably ready for that aluminium foil hat, I would like to remind you that this year ends in the numeral seven, and markets tend to top out in the first three weeks of August in years that end in the numeral seven," the UBS director of floor operations at the New York Stock Exchange said on CNBC's "Halftime Report."
The pattern does not work all the time, but decades of Wall Street watercooler talk have always been wary of years ending in seven and the potential for a September or October downturn, Cashin said.
The most dramatic occurrence in recent memory was in 1987 when the market crashed. The Dow Jones industrial average topped out in August of that year, traded sideways in September, and then fell off a cliff on Black Monday, Oct. 19, 1987. The Dow lost around 22 percent on that day.
"I've been doing this well over a half a century. The way you survive and to sometimes thrive for that long is the first thing you look at when you walk into a room is the exit sign," Cashin said. "If I sound a little cautious, that's the way I've learned to be over the years."
Post-Dow 22K, Cashin said he's particularly troubled with a divergence between the Dow industrials and Dow transports. "The last time we've seen this kind of divergence, the next several months the markets didn't really go anywhere," he said, adding August and September are typically some of the worst months of the year.
In the past 20 years, August has been the worst month of the year for the Dow and the , according to analytics firm Kensho. September has been the third-worst month for stocks.
In the latest earnings season, which is more than two-thirds complete, Cashin said quarterly results are good, but investors owe a big portion of that strength to "financial engineering."
"The corporate buybacks made the earnings look good," he contended.
Disclosure: NBCUniversal, parent of CNBC, is a minority investor in Kensho.
— CNBC's Fred Imbert contributed to this report.