Solar stocks took a beating in the second half of 2015 and throughout 2016, but the sector turned around in 2017. In fact, one exchange-traded fund (ETF) tracking the sector – the Guggenheim Solar ETF (TAN) – generated impressive returns of over 54% last year. Solar stocks soared in the past due in part to federal tax credits for home solar installation and other incentives to stimulate the industry, but the sector was surprisingly resilient in 2017 despite a presidential administration that does not prioritize renewable energy to the same extent as its predecessor.

The facts on the ground suggest that solar's fortunes may remain strong over the medium and long term. Consider that solar energy use is skyrocketing – around 25% of all new energy installations in the first three quarters of 2017 were solar, second only to natural gas. The solar workforce has skyrocketed by 168% over the past seven years, reaching over 250,000 workers in 2017, edging out the number employed in natural gas and nearly doubling the number employed in coal.

Of course, there's continued uncertainty under the Trump administration, which may not pursue aggressive alternative energy policies. On Jan. 23, 2018, President Trump imposed tariffs on imported solar panels, aiming to protect U.S. companies against dumping by foreign manufacturers – a decision that could have significant effects on the industry and its major players.

That said, depending on your point of view, the sunny outlook for the industry may mean that the time is right to jump into solar. If you're considering solar exposure for your portfolio, here are the top picks for the remainder of 2018. Note: All figures are current as of Oct. 1, 2018.

First Solar, Inc. (FSLR)

Following a somewhat disappointing 2016, when revenue was down nearly 20% from 2015, First Solar had an impressive year in 2017. After the company beat consensus estimates in the first two quarters of 2017, the results for the third quarter were even more impressive – First Solar reported third quarter revenue of $1.09 billion, representing year-over-year growth of 60% and crushing the consensus estimate of $824.2 million. While the company missed revenue estimates in the fourth quarter, the adjusted loss of 25 cents per share came in better than expectations of a 33-cent loss.

First Solar could actually benefit from Trump's tariff decision because it uses thin-film solar panels – a different technology than what is employed by the Chinese companies that the tariff is designed to protect against. Thus, although First Solar has manufacturing facilities overseas, its panels are exempt from the tariff. However, the stock's response to the tariff decision was rather muted, indicating that the advantages to First Solar may have been priced into the shares prior to the formal announcement of the policy. (See also: Buy First Solar on Better Products: Deutsche Bank.)

In fact, following a sizzling performance in 2017 in which First Solar shares more than doubled in price, 2018 has been quite a different story, with the stock down nearly 28% year to date. A number of factors could be behind First Solar's recent declines, including concerns about the escalating trade conflict between the U.S. and China as well as U.S. production increases by other companies trying to take a piece of First Solar's tariff-exempt market share. Despite the recent downturn, First Solar remains a major player that is poised to profit from the growth of the industry, and the recent pullback in the shares could represent a buying opportunity for solar bulls.

SunPower Corporation (SPWR)

SunPower lost more than 70% of its value over the course of 2016, a figure that strikes fear in the heart of the average investor. Bankruptcy is a definite concern with some solar companies, but SunPower is majority owned by petroleum giant Total S.A. (TOT), which is propping the solar company up with credit and even purchasing solar panels for its 5,000 gas stations. SunPower is plowing money into new technology from Congenra Solar to boost its solar panels' efficiency and move into utility-scale projects, which could be a game changer for the balance sheet. (For more, see: First Solar a Steal, SunPower Less Sunny: Analysts.)

SunPower has a market cap of $1.002 billion. The stock is currently trading at $7.11 per share. Third quarter 2017 revenue of $533.6 million beat analysts' expectations but was down 30.7% from 3Q 2016. Fourth quarter revenues were also down nearly 25% year over year, although adjusted earnings per share of 25 cents exceeded expectations. In the first two quarters of 2018, the company exceeded expectations by posting narrower-than-expected losses. The imposition of tariffs on solar panels imported to the U.S. raised significant concerns for SunPower because it relies on panels imported from manufacturing facilities in Asia, but according to Reuters, the company is considering expanding production in the U.S.

On April 18, 2018, SunPower announced its agreement to acquire 100% of SolarWorld Americas, a well-known American producer of high-quality solar panels. Similar to the case of First Solar, SunPower shares saw significant declines over the first half of 2018. However, SunPower shares shot upward by around 15% on Sept. 18 on news that certain materials imported by the company would be exempt from tariffs. After giving back some of the recent gains, the stock is currently down around 17% year to date. (For more, see: First Solar and SunPower: Effects of Solar Panel Tariffs.)

Vivint Solar, Inc. (VSLR)

Vivint is a residential solar company that provides both rooftop solar and storage solutions. The stock had a bang-up month in June 2017, rallying over 80% after Goldman Sachs analysts upgraded the shares to Buy and nearly doubled their price target from $3.50 to $6.00 per share. However, Vivint shares subsequently gave up the majority of those gains. Even so, the stock ended 2017 up nearly 56% for the full year, and after some volatility over the first half of 2018, Vivint recovered to 52-week highs above $6 over the summer and currently trades at $5.20 per share, up 30% on the year.

The volatility experienced by the stock in recent months could give investors pause, but the company's move to a cash and loan sales model and its national footprint could make it an attractive acquisition target. Plus, Vivint has some of the lowest solar installation costs in the country. Legislation passed in Nevada last summer allows solar owners to sell excess electricity to the utility companies, which prompted Vivint to restart operations in the state after a two-year hiatus.

Vivint's financial performance has been growing stronger in recent periods. The company has been steadily reducing its operating losses over the past four years, and it managed to generate a gross profit of $37.7 million in 2017. Vivint is poised to deliver additional growth based on the potential of the residential solar industry, particularly in light of California's recent mandate that, by 2020, new homes built in the state must include solar installations. (For additional reading, check out: Sunny Times Ahead for the Solar Sector.)