Here are Jim Cramer's top thoughts on some of the biggest stories of the week.

Jim Cramer: What's Gone Down Goes Down Again ... Then Goes Up? That's IBM

How can the blowout Lam Research ( LRCX) quarter cause the stock to go down and IBM's ( IBM) 22nd straight quarter of declining revenue cause it to have its biggest day since 2002?

It all has to do with the future, not the past.

IBM's stock came in down about 5% for the year going into last night's quarterly report, as there has been endless handwringing about how there's been 21 quarters in a row of revenue drop and now there will be 22.

The negative narrative is so ingrained that the news that the next quarter will break the streak took a lot of analysts, who have dug in negative heels, to get caught offsides.

I think some of the turn is from the end of the big dollar headwinds that have cost IBM a couple of billion dollars in the last year. But most of it is because the new mainframe cycle is kicking in and it has a lot of the features that customers have been clamoring over, including better analytics as well as tight cybersecurity. IBM's mainframe is totally encrypted, which means hackers simply don't have the ability to go after IBM customers like those systems that aren't encrypted. You can say this is the principle of the bad guys scanning the lot for unlocked doors, or you could say you don't have to outrun the bear, you just need to outrun the other guys.

It makes sense, especially because we know one of the worst kinds of breaches is the kind that Cyberark (CYBR) tries to beat, the master-key hack, where a high-level exec leaves and the bad guys spot the departure and burrow in to see if the master key's been returned. IBM's system shuts down if it gets that kind of intrusion. Needless to say, banks and healthcare systems and retailers and those finance and retailing companies using blockchain need a totally encrypted system, too.

So while there is a cyclical bounce to mainframe sales that will produce $300 million to $400 million in excess revenue this quarter -- hence the broken streak -- I think the cyber and analytics themes, the strategic imperatives, are secular in nature and will be layered on to mainframes to spur 2018 sales. That means this is not a one-off revenue turn, it is the real deal. I wonder if Warren Buffett sees the mainframe cycle as a reason to keep the rest of his stock, if he still owns some.

Needless to say, if I am right about the headwinds melting and the tailwinds settling in, we are going to be at the beginning of margin expansion -- the margins are still contracting but at a slower rate -- because strategic imperatives have higher gross margins than the old business that keeps rolling over as part of an unwanted legacy by many customers.

I have been adamant that IBM is a very tough own until we saw three things: 1) the new mainframe cycle, 2) the inflection point on revenue growth and 3) the strategic imperatives becoming more than half the business. The mainframe cycle has started. The inflection in revenues after 22 quarters is here and the big spend to build up the strategic imperatives has wound down while they now stand at 45% and are a shoo-in to get to 50% next year. It's a real renaissance and I think the stock can trade up, over time, to about $190, where it would still be valued only slightly lower than Oracle (ORCL) , which is a decent comparable.

What's best about this IBM quarter is that the two verticals that Watson has targeted, healthcare and financials, are paying off. IBM is winning over the big national health systems with its encrypted, but not slower, mainframes. It is winning over the financials with its secure blockchain and it is giving salespeople something to talk about like they haven't had in years.

Hence why the stock is going up the most in years. It should, as all tech stocks do when they inflect. Hats off to Katy Huberty at Morgan Stanley for being the first to call this one and is using that $192 price target and Oracle comp that I just mentioned. I am thrilled to welcome Martin Schroeter, IBM's straight-shooting CFO, to Mad Money in tonight's broadcast.

How about the A student, Lam? The quarter, while unbelievable from Lam, is again calling into question the sustainability of the order surge that has brought levels of orders for capital equipment to unimaginable heights vs. what we would have expected just a year ago.

The company is saying its customers, mostly DRAM and flash buyers, are being disciplined and not putting up enough greenfield factories to flood the zone and cause prices to dip. No one believed the company last time and the stock got shelled, affording Lam great prices to buy back stock. The fact is, though, Lam was up 83% going into the quarter and that's just too much regardless of how good the quarter is. Plus, ever since that amazing Applied Materials (AMAT) investor day where the management talked about its OLED (organic light-emitting diode) product, it's been the better performer. It should stay that way.

I think that Martin Anstice, the incredibly good CEO of Lam, told a compelling story about how this time is different and the data center and devices present so much demand that it can't be sated. But where I am wary is with this Bain-Apple (AAPL) deal to buy Toshiba's semiconductor business. If it goes through, it will be done with the idea of enriching Apple with cheaper flash than is currently available. That could hurt Lam. (Apple is part of TheStreet's Action Alerts PLUS portfolio.)

Second, I do not like the idea of hoping that Samsung will be disciplined in putting up plants. I have no idea how fast they can do it, but they certainly can do it.

Finally, Apple, Cisco (CSCO) and HP (HPE) have all pretty much said that while DRAMs will be tight in the first half of the year -- something that concerns Anstice -- they believe prices will drop in the second half. None of them has been that bearish before.

That's why I wanted you to take profits in Lam in yesterday's session because this is what happened last time the company reported a blowout, except the concerns seem more real to me. I would have felt much better had Western Digital (WDC) been able to get the Toshiba business. It was a major blow and I think the courts are going to OK the Bain-Apple plan.

So one goes up because it's the last bad quarter and the other goes down because people fear it's the last great one.

The C student gets a B and the A student just gets another A. I will back the C to the B any time in the Wall Street report game because C to a B amounts to a re-rating while just another A doesn't create the upside that it might have when the honor-roll streak started. That was when the Internet of Things and data center orders overwhelmed the flash and DRAM makers with demand that couldn't nearly be met just 18 short months ago.

Join Jim Cramer, CNBC's Jon Najarian and Other Experts Oct. 28 in New York

Jim Cramer will host CNBC's Jon Najarian, TD Ameritrade's JJ Kinahan, famed analytics expert Marc Chaikin and other market mavens on Oct. 28 in New York City to share successful strategies for active investors.

You can join them as they discuss how smart investors can make the most of options trading, futures contracts, fundamental and quantitative analysis and great ETFs to buy right now. Participants will also get a chance to meet Jim and other panelists and take photos.

When: Saturday, Oct. 28, 8 a.m.-3 p.m. ET

Where: The Harvard Club of New York, 35 W. 44th St., New York, N.Y.

Cost: $250 per person.

Click here for the full conference agenda or to reserve your seat now.

More of What's Trending on TheStreet:

Action Alerts PLUS, which Cramer co-manages as a charitable trust, is long AAPL.

Originally published Oct. 18 at 11:49 a.m. EDT.

Jim Cramer: Stocks May Be Cheaper Than We Think

Maybe stocks are cheaper than we think. When we see gigantic Dow Jones stocks jumping like small caps, helping the average trade through 23,000, we know that something's afoot and it isn't alchemy.

Plus the broader averages reflect this same sort of move.
 
What do I mean by the valuations not being that expensive? Okay let's start with some household names. This morning Johnson & Johnson ( JNJ) , the company with the best balance sheet of any major American enterprise, reported a blistering number with pharmaceutical sales up 15%. That's amazing. That's turbo charged growth. Yet, on a price-to-earnings valuation, the only realistic albeit arcane way to measure the worth of company, this stock sells at 17 times earnings. How is that possible? How does that make any sense ? I mean Colgate ( CL) , which, frankly, hasn't invented anything, sells at 26 times earnings. Clorox  ( CLX) , which is an inventive company but only with a fraction of JNJ's growth sells at 24 times earnings.
 
Nelson Peltz, who very narrowly lost an election to the board of Procter & Gamble (PG) is upset that the world's largest consumer product company doesn't innovate more and yet it sells at 22 times forward earnings.
 
And JNJ sells at 17 times earnings? You could say that all of those other stocks should sell dramatically lower, but I am not going to go there. I think they are expensive and JNJ is cheap.
 
Or how about United Health ( UNH) ? This $200 billion market cap health insurer just reported 21% revenue growth yet it sold at just nineteen times earnings until today. That's a substantial discount to the growth rate. Now you could say that earnings from operations only grow 13% but still, 19 times earnings for 13% growth? That, too, is absurd.
 
Morgan Stanley ( MS) with a steady as she goes wealth management business that is just getting better and better with increasing growth margins and a pretty much by clockwork business model, sells at sells at 14 times earnings. Morgan Stanley is one of the best investment firms in the world with consistent growth. I don't get that valuation at all. No more than I get that JP Morgan ( JPM) is selling at 14 times earnings with the best growth I can recall, the lowest non-performing loans I can remember and a new rate cycle ahead that could raise earnings by billions of dollars and the company doesn't have to add a soul to its ranks to get that return?
 
I am telling you as someone who watches earnings and knows how much people paid for them historically, these prices just don't make any sense to me.
 
Same with Goldman Sachs  ( GS) . Okay, so was the quarter perfect? No, its business model has not migrated enough to a less trading oriented beast. But it is getting there. I don't know a soul in banking that doesn't want to go there. Its tangible book value is at $200 a share, which means if you closed the damned place that's how much cash it would have on hand. It's been buying back stock buy the millions of shares a quarter. And it is going to earn $20 a share next year. Shouldn't this stock get a 15 multiple and not its 12 multiple now?
 
Remember, we have no other historical way to measure value than the ones I am throwing at you and they make little sense to me. I believe that after a few days of selling that come from partners being able to take advantage of a selling window, this one will be ready to buy, too.
 
Some industries truly make no sense to me. The airlines sell between eight and 10 times earnings and yet they have never had this level of profitability in history. Their balance sheets are amazing. After some turmoil in price cutting the numbers are stabilizing. Now normally I would say, hold it, be careful, they are flush, they will buy more planes, they will offer more flights and their numbers will get crushed.
 
But you know what? The queue for more planes is miles long. Our infrastructure is so pathetic they can't add many gates any longer. And the price increases for all of those niggling things like baggage weight and seat selection are sticking!
 
We've gone over the re-rating of General Motors ( GM) several times now, but can you believe this is the company with autonomous driving coming to Manhattan NOW? Even after the run this stock has had, it sells at seven times earnings, Come on Man!
 
Or how about Allergan ( AGN) . Look, I am well aware of how pathetic this stock has traded. It is down fifty straight bucks on the possible loss of patent protection involving its Restasis drug that has less than $2 billion in revenue. It's lost more than $15 billion on exclusivity of one drug. It sells for 12 times earnings? I can't figure that out. I just can't. Even the bears are expecting an up year.
 
Now I know there are anomalies that make us think the stock market is expensive. We have watched the stock of what had once been the world's largest industrial, GE ( GE)   , just get clobbered as new CEO John Flannery tries to get around everything from the ill-advised buying high of an infrastructure business and oil and gas while it sold finance at the low. It couldn't have been worse at GE and it is not getting better soon. Hopefully on Friday, when GE reports, we will get a clearer view of how much it might have to cut its inflated dividend. I say inflated because there's been some very suboptimal reporting tactics at this firm by not one but two former CFOs that has been, in my vocabulary, just shameful.
 
And we have some stocks that are front and center that just cannot be explained by conventional earnings measurements and that makes people very wary. Tesla ( TSLA) , Netflix ( NFLX) and Amazon ( AMZN) are all companies with valuations that older investors are just furious about, even as a paucity of younger investors gather to buy. Why is this? because they think Tesla is a tech stock, and Netflix and Amazon are bargains because a Netflix monthly fee is less than going to the movies to see one ridiculously horrible film instead of an engrossing series, and because Amazon's valued on its ability to take over the world and the gross margins of everyone else in retail. Very hard to figure.
 
At least Alphabet ( GOOGL) and Facebook ( FB) can be more than justified on a price to earnings basis out the next couple of years because they are incredibly lucrative. If Facebook can earn nine bucks in 2019 wouldn't you pay 25 times earnings for the world's fastest growing large capitalization stock?
 
Finally there's Apple ( AAPL) . Here's a company that is denigrated at every turn by the tech analysts who follow it. Yet I often want to ask them, do you use Samsung?
 
I mean really.
 
Okay, is it a pioneer in artificial intelligence the way Amazon and Spotify are? No, Does it have the edge in social and cloud and machine learning? No. But does it have the best consumer product company in the world? Of that there is no doubt and it could charge double for its service revenue and there would be nowhere else to go because it is a seamless ecosystem. Yet it sells at 17 times earnings and I am not backing out its enormous hoard of cash because that's not the way you do it.
 
I tire of hearing how expensive stocks were. I traded in 1987 when we crashed this week. Stocks were at 29 times earnings. Interest rates were at 7%, a much better alternative than now. We deserved to crash for heaven's sake. If we do it this time? You better have some cash as it will be an even bigger gift than when it crashed 30 years ago.
 
I hear people say, but Jim this is peak earnings and as I wrote earlier you know I am worried about DRAMs and flash memory and therefore about Lam Research ( LRCX) . I hear them say "but Washington can't get anything done." Do you see anything about tax reform being approved here? I hear them say, "wait until the fed raises rates," but we have already had a bunch of raises and we've done fine. I hear them say that "it is all a Fed bubble." Guess what. We have now almost tripled in the Dow from when I first heard those arguments. Yes, they are as cogent now as they were then. But did they make you money? No. And isn't that the ultimate arbiter?
 
Action Alerts PLUS, which Cramer co-manages as a charitable trust, is long AGN, GE, FB, GOOGL and AAPL.

Originally published Oct. 17 at 3:35 p.m. EDT.

Jim Cramer fills his blog on RealMoney every day with his up-to-the-minute reactions to what's happening in the market and his legendary ahead-of-the-crowd ideas. This week he blogged on:

  • How new FANGs might be coming
  • How to find the open receiver in a pullback
Click here for information on RealMoney, where you can see all the blogs, including Jim Cramer's--and reader comments--in real time.

More from Investing

Biotech's Coming Back to Life: Cramer's 'Off the Charts'

Biotech's Coming Back to Life: Cramer's 'Off the Charts'

Papa John's: The Noise and the Stock Price

Papa John's: The Noise and the Stock Price

CSX Rises on Earnings, Revenue Beat

CSX Rises on Earnings, Revenue Beat

United Beats Second Quarter Earnings Estimates

United Beats Second Quarter Earnings Estimates

Video: Here's How Goldman Sachs May Change Under David Solomon

Video: Here's How Goldman Sachs May Change Under David Solomon