As the stock of semiconductor manufacturer Nvidia tumbled in after-hours trading on news of a Tesla-AMD partnership focused on self-driving cars, CNBC's Jim Cramer had to figure out what to do next.

Shares of Nvidia hit an all-time high on Monday following several analyst upgrades that cited the company's promising position in the fields of artificial intelligence, gaming and data centers.

But with the stock now falling from its highs, Cramer wouldn't blame investors for feeling uneasy about what's next for Nvidia.

"Perhaps after its rally and this AMD news, the stock actually deserves to get punished. Perhaps this is just one more buying opportunity, though," the "Mad Money" host said. "You have to know what you're doing and what could happen to the stock."

So Cramer enlisted the help of technician Carolyn Boroden, the creator of FibonnacciQueen.com and one of Cramer's colleagues at RealMoney.com.

Boroden has a notable track record on predicting chipmakers' stock moves. In August, she said Nvidia's rally was far from over, predicting upside targets of $180 and $188 with a ceiling at $209.

So far, Nvidia's stock has followed Boroden's predicted path, which is based on Fibonacci ratios. She uses the medieval mathematical system to find the levels at which a given stock is likely to change its path based on past swings. She also uses it to find the dates when trajectory changes are the most likely to help investors find the best times to buy or sell.

With Boroden's methodology in mind, Cramer turned to the daily chart of Nvidia.

Boroden noticed that the stock has already made a 127.2 percent extension of its last swing. An extension, or how much lower a stock's current decline is than its previous one, tends to mark the end of a stock's rally, which means Nvidia could be due for a bigger pullback, Cramer said.

Moreover, Nvidia's longest rallies have lasted between 25 and 29 trading days, and Monday marked the most recent rally's 25th day. Cramer said the pullback may have already started given the negative action in Nvidia, which means its rally could be tapering out.

Boroden also found that Nvidia tends to lose momentum after running up anywhere from 35 to 42 points. The last time this happened, the stock got hit before restarting its climb.

Cramer doesn't necessarily think that pattern will repeat itself, but he thought it was worth noting that Nvidia's shares gained $38.29 from their low on August 11 to their high on Monday, putting it right in the range that indicates the rally may have run its course.

So while Cramer's charitable trust, which owns shares of Nvidia, isn't taking any action, Boroden would bless some profit-taking if the stock holds up its historical patterns and starts to decline.

And for investors who don't own Nvidia, they could be about to get a great buying opportunity in the next week or so, Cramer said.

"Here's the bottom line: I like Nvidia, but I love protecting your profits even more," Cramer said. "The charts, as interpreted by Carolyn Boroden, suggest that Nvidia could be due for a $10 to $30 pullback after its recent run, and if you're nimble, maybe you want to try to sidestep some of that decline. More important, if Nvidia is pulverized like that, well, maybe you get a chance to own a piece of this great semiconductor company with a remarkable number of strengths and very few weaknesses, even as this potential loss of the Tesla business to AMD could certainly be one of them."