The market's moves are totally determined by oil

Oil barrels prices Royal Dutch Shell Plc
Andrey Rudakov | Bloomberg | Getty Images

After the price of crude oil turned lower Tuesday, the S&P 500 erased its earlier gains of more than 1 percent and closed essentially flat on the day. This is no coincidence.

The world's most important commodity, which is down more than 20 percent year to date, has become the determining factor for market movements, data show.

So if oil is down, sell your stocks, recent history shows.

Using Kensho, a quantitative tool used by hedge funds, CNBC Pro analyzed the historical relationship. Here is what we found.