CNBC's Jim Cramer said he was "aghast" at the huge swing between the sharp decline in stock futures Monday evening and the strong Wall Street open Tuesday.

The "Mad Money" host blasted "pajama traders," the term he coined for those who buy and sell futures contracts, often based on computer algorithms, during market off-hours.

"Why don't they just go work for NASA?" Cramer asked, rhetorically, suggesting their computer skills would be better used elsewhere. "Why do they have to wreck our markets?"

After the Dow Jones Industrial Average on Monday tanked 767 points, or 2.9%, on concerns about the U.S.-China trade war turning into a currency battle, Dow futures were down more than 600 points after hours. But early Tuesday morning, they turned positive after China allowed its currency to rise, one day after letting it drop to its lowest level in more than a decade.

Cramer said making investment decisions based on what stock futures are doing outside the regular market session is ill-advised. He said, "Don't buy up openings, period," adding that "nine times out of 10, it's been a fool's game."

"I'm still aghast at what happened last night," Cramer added Tuesday on CNBC. "It was almost as if it was a huge, huge seller who was so wrong."

"These things colored people's mind when we left here" after Monday's market close, he said. "It's a thin market. The algos were going nuts," he added, referring to algorithmic computer trading that dominates markets.