Buy the at the close every day and sell it at the next open. Sounds wacky? You could have outperformed the market by 20 percent.

According to Bespoke Investment Group, if one had implemented this so-called after-hours strategy every day in 2018, it could've posted a 13.3 percent return.

"This has really been an intraday bear market, with more than 100 percent of the selling coming during regular trading hours. Since SPY's peak on Sep. 20, you'd still be up 3.3 percent if you only owned outside of regular trading hours!" said a team of analysts at Bespoke in a note Monday.

If one had bought the S&P 500 at the open every day and sold at the close, they would've lost 20.4 percent.

Intraday selling has been prominent especially in the fourth quarter as big investors rushed out of the market and tax-loss selling intensified at year-end. It has been otherwise tough to reap a profit in the stock market this year as the S&P 500 has lost more than 7 percent on trade disputes and slowing economic growth.

However, this trading strategy doesn't entail any fundamental backing so it is likely impossible to predict whether it would keep working in the new year. In addition, it does not account for trading costs, which could add up with excessive buying and selling every day.

But in theory, it was a rare strategy that worked in 2018.