If you’ve lost money on Chipotle (CMG), don’t feel bad.

This was once a Wall Street darling who was doing everything right. Back in 2012-2014, the company couldn’t lose. Its marketing was on point, it was attracting the attention of a young and captive audience, it was seen as environmentally friendly and ethical, and it was actually creating a brand-new category (fast casual) that was taking market share from its higher and lower tiers. All of this helped the stock shoot up to over $700 and a P/E ratio usually reserved for tech firms, despite the company’s decidedly low tech approach to its business.

Sadly, that low tech approach became a big problem in 2015.

When the company was suddenly hit by an e. coli outbreak and subsequent scandal, management responded laudably. They took responsibility, worked to fix the problem, and immediately started to change its operations. Sadly, the outbreak spread and new controversies over unpaid overtime and worker treatment meant the company’s goodwill was severely hindered. The stock remains over 30% off its all-time high and now maintains an absurd 572 P/E ratio.

To battle its financial woes, Chipotle has increased prices in the hopes of increasing margins to get that ratio in check. The market has responded positively, giving the stock its 52-week high price point thanks to a recent and nowadays unusual price bump. We’re still not at pre-crisis price levels, but at least anyone who bought in 2012 is back in the green.

However, anyone who bought CMG back then or since and has made little money—or lost money—shouldn’t feel bad. Buying CMG back in 2013 was the right thing to do even if it meant losing money in the long term.

This brings us to one of the paradoxes about investing. It’s always about making money except when it isn’t. Sometimes investors make money because of dumb luck, and that’s not something to be proud of. In fact, a professional who boasts about making a profit after, for instance, buying the wrong stock because of a typo on a terminal, would not only be seen as dangerous but could possibly be fined by the SEC or FINRA. Making money by accident is worse than losing money on purpose.

To understand why this is the case, let’s think back to why exactly people lost money on CMG. They bought the stock at a time when its revenue was growing, its EPS was expanding nicely, and the firm was eyeing new market segments. With consumer enthusiasm, strong marketing acumen, and a popular product in a growing sector, there was no reason to doubt CMG couldn’t do it. The only reason they failed was bad luck on their part: a sudden outbreak of a bacteria that, unfortunately, breaks out at many restaurants around the world (no matter whether those restaurants tout organic food or use tons of artificial chemicals every day).

The bacteria outbreak not only ran counter to the brand’s main selling point, but it even seemed to undermine the brand’s biggest strength: its focus no fresh, natural ingredients. It became easy to criticize CMG, and it became even easier to avoid the restaurant. After all, who wants to get sick?

Of course avoiding CMG for the last 2 years hasn’t made anyone healthier, since the restaurant hasn’t had any new e. coli outbreaks since then. And one must wonder if people got sick by choosing another restaurant that itself ended up poisoning its customers because of bad luck. Thousands of food poisoning cases happen in America every year; it’s actually quite common.

A real investment professional understands that analysts will sometimes suffer bad luck. And if you were a portfolio manager at a hedge fund interviewing two analysts, you’d choose the one who lost on CMG instead of the one who won because they mistakenly bought the wrong stock. Because luck doesn’t repeat, so the unlucky money loser is unlikely to be unlucky again and the lucky winner is unlikely to make a profitable mistake again.

This gets at the core of investing: it’s not gambling where you hope for luck. It’s about measured, premeditated risk taking in which upsides and downsides are quantified as much as possible by using as much data as you can. The CMG loser clearly did that more than the winner who made a typo on his terminal.

Investment professionals will not be ashamed of losing money. They will, however, be willing to understand why they lost money and how they can avoid making that same mistake again. Or, alternatively, they can recognize when they were just unlucky.