The stock market is affected by the laws of supply and demand, Jim Cramer reminded his Mad Money viewers Tuesday. Right now, we're in the middle of a serious stock shortage, Cramer proclaimed, and that means prices will head higher.

There are two main factors contributing to the fact that there's simply not being enough shares to go around.

The first is the rise of index funds. For years, investors have been told index funds are the place to be and with strong employment, households are saving, and investing, more than ever. This creates a hoard of automatic buyers, Cramer said, buyers that are less inclined to sell than those who pick individual stocks.

The second factor contributing to the stock shortage are the companies themselves. Stock buyback programs are also heading toward record levels, thanks to strong earnings and tax breaks. Some buyback are simply gigantic, creating a solid floor of support on any weakness.

These factors combine to create an environment where money managers need to buy stocks to beat their benchmarks, but can't find enough shares for sale. When there aren't enough shares to go around, he said, prices rise.

That's exactly what happened today, as the rally was led by the financials, then spurred by rising oil prices, followed by strength in the industrials.

Cramer and the AAP team are getting ready for their monthly members-only call, set for 11:30 a.m. Eastern on Thursday, Aug. 9. Find out what they're telling their investment club members and get in on the conversation with a free trial subscription to Action Alerts PLUS.

Off the Charts

In the "Off The Charts" segment, Cramer checked in with colleagues Tim Collins and Larry Williams over the charts of three retail stocks that might be poised to compete with Amazon.com  (AMZN) .

Collins first looked at Walmart (WMT) , noting the stock has been trading sideways since March, but has also formed a rounding bottom with a bullish channel. With shares breaking the ceiling of that channel today, shares could be ready to head towards $100.

Collins was not as bullish on Target (TGT) , which has been bullish since March, but may now be overextended.

Finally, Williams looked at Cramer favorite Costco (COST) , noting that this stock is strongly correlated to the U.S. dollar, which is now in a downtrend. He advised taking profits.

Cramer said he'd use any gains in Costco and Target to swap into Walmart. 

Bargaining Chips With China 

The only way to win the trade war with China is to make a deal, Cramer told viewers, not by continuing a long, drawn-out siege. Today's news that the Chinese may be considering boycotts of American goods and companies, including Apple (AAPL) , is a warning of the pain shareholders may soon be facing.

To be clear, Cramer said, he agrees with America standing up to China for dumping steel and stealing our intellectual property, but victory can only be had through negotiation, not by continuing to add new tariffs on what seems like a weekly basis.

Boycotts may be one of the most effective ways China has to retaliate, Cramer added. The language in today's news may put Apple, which has been a model Chinese citizen, in the crosshairs of the political fight.

Now's the time to make a deal, Cramer concluded.

Over on Real Money, Cramer says Zillow (Z) appears to be running out of room to grow as it morphs into a real estate broker. Get more of his insights with a free trial subscription to Real Money.

Executive Decision: Logitech 

For an "Executive Decision" segment, Cramer again sat down with Bracken Darrell, president and CEO of Logitech (LOGI) , the computer accessory maker that was once tied to personal computers, but has now embracing gaming and eSports. Shares of Logitech are up 90% since Cramer first spoke with Darrell in November 2016.

Darrell said eSports continues to gain momentum and we're not even near "the end of the beginning." His prediction is that gaming will become the biggest sport in the world over the next 15 to 20 years. Colleges are beginning to offer gaming scholarship, he noted, and Logitech's sales for gaming items, like headsets, has tripled in recent quarters.

Logitech continues to embrace its traditional PC accessories as well, with items like keyboards, mice, webcams and microphones.

Cramer said that Darrell saw the eSports trend before anyone else.

Taking the Pulse of Healthcare

Wall Street got too bullish with the hospital stocks, Cramer cautioned viewers. That means investors need to stick with best-of-breed players, and among the hospital stocks, that means HCA Healthcare (HCA) .

Cramer explained that HCA operates 178 hospitals, as well as surgical centers, in 20 states, including in the South, where the economy remains strong. Shares are up 47% for the year, but Cramer said the stock still has more room to run after the company reported not one, not two, but three earnings beats in a row.

After raising its earnings forecasts two weeks ago from between $8 and $8.50 a share to $9 and $9.40 a share, shares still trade for a scant 13 times earnings. That compares to 21 times earnings for rival Encompass Health (EHC) , which isn't growing as rapidly. 

Lightning Round

In the Lightning Round, Cramer was bullish on GTT Communications (GTT) and FMC Corp (FMC) .

Cramer was bearish on Canopy Growth (CGC) and Vivint Solar (VSLR) .

Search Jim Cramer's "Mad Money" trading recommendations using our exclusive "Mad Money" Stock Screener.

To watch replays of Cramer's video segments, visit the Mad Money page on CNBC.

To sign up for Jim Cramer's free Booyah! newsletter with all of his latest articles and videos please click here.

At the time of publication, Cramer's Action Alerts PLUS had a position in AAPL, AMZN.

More from Jim Cramer

JetBlue, Southwest, Johnson & Johnson: 'Mad Money' Lightning Round

JetBlue, Southwest, Johnson & Johnson: 'Mad Money' Lightning Round

Worried About the Right Thing?: Cramer's 'Mad Money' Recap (Tuesday 8/14/18)

Worried About the Right Thing?: Cramer's 'Mad Money' Recap (Tuesday 8/14/18)

Rewind: Jim Cramer on Home Depot, Tapestry, Nordstrom and Square

Rewind: Jim Cramer on Home Depot, Tapestry, Nordstrom and Square

Jim Cramer on Tapestry: Accessories Are the Hottest Area of Retail

Jim Cramer on Tapestry: Accessories Are the Hottest Area of Retail

Jim Cramer on Tuesday's Market Gains: Let's Not Get Carried Away

Jim Cramer on Tuesday's Market Gains: Let's Not Get Carried Away