The stock market has been experiencing wild gyrations in recent trading periods, suggesting investors are trying to decide whether this bull market will suddenly turn bearish. Trying to divine which way the market will go is a (small-f) fool's errand, though, because as pundits have noted, it can remain irrational far longer than your money can last.

A better bet would be to select stocks that do well in both bull and bear markets, and Brookfield Renewable Partners (BEP 0.92%), Microsoft (MSFT -1.27%), and Clorox (CLX 0.24%) are three stocks that might just fit the bill in these dicey times.

Solar panels and wind turbines

Image source: Getty Images.

Renewable energy's dividend king

Travis Hoium (Brookfield Renewable Partners): Whether the market is going up or down, the sun will shine, the wind will blow, and rain will fall. Those natural forces are what provides the energy Brookfield Renewable Partners' power plants need to generate electricity and, ultimately, the cash flow that drives the company's dividend. 

Brookfield Renewable Partners is a yieldco that owns renewable energy assets that sell electricity to utilities, businesses, and homeowners. CEO Sachin Shah explained the strategy best during the company's fourth-quarter conference call: 

Our strategy is simple: acquire renewable power assets and businesses at below intrinsic value, finance them on an investment-grade basis, and optimize cash flow and value utilizing our depth of operating expertise. 

Being a successful yieldco isn't just about owning renewable energy assets, it's about being an opportunistic acquirer of assets. Few companies have a long-term track record of strong portfolio management like Brookfield, exemplified by its recent acquisitions of TerraForm Global and a controlling stake in TerraForm Power (TERP). These acquisitions gave Brookfield Asset Management a 100% stake in TerraForm Global and a 51% stake in TerraForm Power, with Brookfield Renewable Partners owning 31% and 16%, respectively, and are already adding to the company's cash flow. 

It's the growth in cash flow that Brookfield Renewable Partners uses to pay its annual dividend of $1.96 per share. Management intends to grow the dividend 5% to 9% annually by using excess cash to fund growth acquisitions like the TerraForm companies. With a strong track record of profitable and opportunistic acquisitions in renewable energy, this is a dividend I would count on no matter what the market does. 

Microsoft Windows laptop

Image source: Microsoft.

Cash is always king -- in bull and bear markets both

Rich Smith (Microsoft): Last time I was asked to pick a stock that could thrive in both bull and bear markets, I suggested that investors consider computer software magnate Microsoft. That turned out to be pretty good advice: Microsoft stock is up 12% in the last four months, or roughly 12 times the S&P 500's 1% gain.

So, I think I'll pick Microsoft again.

After all, not much has changed to dissuade me from my original thesis, which was not so much that Microsoft is a dominant software company, whose Windows operating system runs on more than four out of five computers worldwide (although it is, and it does). Rather, I argued that Microsoft is worth owning primarily because it is such a good producer of cash -- and cash is something that appeals to investors in both good markets and bad.

According to data from S&P Global Market Intelligence, Microsoft generated $33.3 billion in positive free cash flow last year, which is more than enough to cover the $12.5 billion in dividend checks that Microsoft cuts every year. Even in the event a bear market curtailed or eliminated that flow of cash, though, Microsoft has already built up a cash hoard of some $45.3 billion net of debt. That's enough cash to fund Microsoft's $12.5 billion in annual dividend payments for the next three and a half years straight -- even if the company stopped making money tomorrow.

If you're looking for a great dividend stock that can guarantee your dividends in good markets and bad, look no further than Microsoft.

Woman looking at bleach bottle

Image source: Getty Images.

Cleaning up with Clorox

Rich Duprey (Clorox): Although bleach might be the first thing that comes to mind when Clorox is mentioned, it also owns a broad portfolio of other brands including Glad trash bags, Kingsford charcoal, and Fresh Step and Scoop Away kitty litter. Still, cleaning products generate the most revenue for Clorox, some one-third of the total, with household products like Pine-Sol accounting for almost another 30% of the $6 billion total.

While Clorox gives homeowners a sense of familiarity with its portfolio, it gives investors stability. The cleaning agent is a powerhouse of dividend payments, having raised its shareholder payout every single year since 1977. That's a record that puts it among the Dividend Aristocrats that have weathered many storms, from war and global disasters to market turmoil and recessions. Today, its dividend yields a healthy 2.9%.

Over the past decade, Clorox's stock price has gained 135% compared to the S&P 500's doubling in value. Not bad for a mundane consumer-products company. Although it expects sales growth to only rise by 1% to 3% this year, it raised its full-year earnings per share forecast to a range of $6.17 to $6.37, helped along by tax reform.

Investors should remain confident that regardless of which way the market goes in the future, bull market or bear, Clorox will be there, plugging away as it always has, and continuing to pay out a dividend to shareholders.