No matter how much you love the stocks in your portfolio, discipline must always trump conviction, Jim Cramer told viewers Friday night in a special episode of Mad Money. Rules help remove emotion from investing, and you violate them at your peril. Cramer's made many mistakes during his 40-year career, and you can avoid many of them by just following these simple rules.

The first rule has become a pillar of Mad Money, and that's the notion that bulls make money, bears make money, but pigs get slaughtered.

How do you know when you're being needlessly greedy? Cramer said you'll just know it when it happens, and yes, you can be a short-selling pig as well.

We all saw what greed looks like at the height of the dot-com era in 2000. We saw it again at the height of the housing bubble in 2008. The fact is that if you get greedy and then get wiped out, you won't be able to stay in the game, and staying in the game for the long term is what investing is all about.

That led Cramer to his second rule: It's OK to pay taxes on your gains. Too many times investors refuse to lock in gains for fears of a big tax bill. But Cramer cautioned that it's better to have a taxable profit than no profit at all. Cramer's bottom line? Make peace with the tax man and don't get greedy.

Also from Friday's episode of Mad Money: Cramer's game plan for a tsunami of earnings reports next week.

Buy -- and Sell -- With Patience

Cramer's next rule for investing: Don't buy all at once. Never sell all at once, either.

You'll never be good enough to time the market perfectly, Cramer cautioned, and if you're wrong, you'll be really wrong. That's why it's always better to buy in stages. Your goal is to get the best price over time, not the best price for today. Be patient, and wait for opportunities to arise.

The next rule is look for broken stocks, but not broken companies. If you buy something at the mall, and it's defective, you can always return it. Unfortunately, investing doesn't work that way. That's why broken companies, those with balance sheet concerns, accounting problems or end markets that are in secular decline need to sold immediately.

Broken stocks on the other hand are different. Thanks to the emergence of index funds, sometimes stocks go up and down with the broader markets through no fault of their own. When the market is down significantly, that's the time to snap up the favorite stocks on your buy list.

Spread the Love Around

Making money in the stock market doesn't just happen, it takes a little work -- homework, that is. If you don't have at least an hour a week to dedicate to your portfolio, Cramer said you're probably better off investing in a good S&P 500 index fund. But if you're interested in individual stocks and you have some time to dedicate to it, read on.

Cramer said homework is not difficult, it's mostly research. You have to visit a company's website and learn about what it does. Then you have to listen to the conference calls and know what the analysts are saying and what's in the news. Only then can you truly understand why you'd want to own it and what you should expect from it.

Just as important as homework is another pillar of Cramer's Mad Money philosophy. That's diversification.

Diversify, diversify, diversify, Cramer told viewers. Stocks trade together, which makes sector risk one of the biggest challenges investors face. Nearly 50% of a stocks action, up or down, comes from the sector it's in.

That's why Cramer still plays "Am I Diversified" frequently on the show. Diversification should be a given, but too many times people thing that FANG (Cramer's acronym for Facebook (FB) , Amazon.com (AMZN) , Netflix (NFLX) and Alphabet/Google (GOOGL) ) is diversification, but these are all different versions of the same thing -- growth stocks.

It doesn't matter if you love tech, oil, the financials or healthcare. Too much of one sector can sink any portfolio.

Investor, Know Thyself

Cramer's last lessons for investors were, first, that "you are often your worst enemy" and second, "no one ever made a dime panicking."

Humans are full of emotions, but emotions are not part of investing. If you've done your homework, then you know what you own, why you own it and when you plan to sell it. Don't let emotions make you deviate from your plan.

Along those lines, Cramer reminded viewers that panic is never a strategy and there will always be a better time to sell. In the middle of a big market decline, when investors are heading for the exits, that's never the time to sell. There will always be a rebound tomorrow or maybe the next day or even next week. You just need to ride out the storm.

It's all too easy to get defensive when your stocks are falling, but its important to remain logical and ask yourself if your homework thesis still fits the current environment. If not, then it's time to sell those laggards at the next sign of strength and move onto what's working. If you don't have a catalyst, or reason to own a stock, it shouldn't be in your portfolio.

Cramer and the AAP team talk are adding to their holding of Schlumberger (SLB) , and keeping a close eye on Google. 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.

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 FB, AMZN, GOOGL, SLB.

More from Jim Cramer

What to do When You See a Bear: Cramer's 'Mad Money' Recap (Wed. 11/14/18)

What to do When You See a Bear: Cramer's 'Mad Money' Recap (Wed. 11/14/18)

Blackstone Group, Microchip Technology, First Data: 'Mad Money' Lightning Round

Blackstone Group, Microchip Technology, First Data: 'Mad Money' Lightning Round

Jim Cramer: Why the Bear Market Appellation Is Worthless and Gets Us Nowhere

Jim Cramer: Why the Bear Market Appellation Is Worthless and Gets Us Nowhere

Ask Jim: Time to Sell or Hold Simon Property Group?

Ask Jim: Time to Sell or Hold Simon Property Group?

Why Jim Cramer Likes Canada Goose

Why Jim Cramer Likes Canada Goose