If you’re thinking of investing in solar energy companies, now might be a good time to buy.

Most of the major publicly traded solar companies have seen their stock prices decline by around 10 to 20 percent over the last three months. SolarCity, a residential and commercial supplier, has dipped from $54 to $49 per share. First Solar, which makes utility-scale projects, dropped from $56 to $43. Panel manufacturers JinkoSolar and SolarWorld are down from $23 to $18 per share and $14 to $12, respectively.

Normally, declining stock prices would reflect weak growth or a shaky outlook for an industry. But solar energy is growing by leaps and bounds. In the first three quarters of 2014, 3,966 megawatts of solar capacity were installed in the U.S., compared to 2,647 MW in the first three quarters of 2013. Solar deployment is not only expanding, but the pace at which it’s growing keeps accelerating. In 2014, according to a new report from the Solar Foundation, an independently funded think tank, the solar industry added workers almost 20 times faster than the overall U.S. economy, accounting for almost 1.3 percent of all jobs created.

So why are solar stock prices not keeping pace? Because American investors are uninformed, apparently. It turns out that the free market and its crowd-sourced opinions are not always so wise after all.

Energy industry analysts say the only good explanation for the decline in solar stocks is that oil prices are way down, from $114 per barrel of Brent crude last June to about $45 per barrel today. If oil competed with solar, that would be bad news for solar — but it doesn’t. Solar is used to generate electricity. Oil, in contrast, is used primarily as a transportation fuel and, to a lesser degree, for home heating. Oil accounts for only 1 percent of U.S. electricity generation. Nonetheless, some investors, by conflating different elements of the energy market, make the mistaken assumption that the two power sources are going head to head.

“[Solar energy companies] are pretty much all down over the past few months,” says Shayle Kann, senior vice president of research at Greentech Media, a market-analysis firm focusing on renewable energy. “It does appear to be because the price of oil is falling. But that makes no sense.”

“It certainly doesn’t match the overall growth that we have seen not only over the last 12 months and the last four years, or what [solar companies predict] about next year,” says Solar Foundation Executive Director Andrea Luecke.

The solar market should be largely unaffected by oil prices, and instead influenced by price swings in coal and natural gas, which are the two main sources of electricity in the U.S. Natural gas is also experiencing a production boom, but, for various reasons such as pipeline constraints, natural gas prices have not fallen as dramatically as crude oil. “Oil prices used to be highly correlated with natural gas prices, which would have an effect [on demand for solar], but oil and gas prices are not nearly as highly correlated as they used to be,” says Kann.

Nat Kreamer is chair of the board for the Solar Energy Industries Association, a trade association, and CEO of Clean Power Finance, a financial services and software company for the residential solar industry. At a recent conference of institutional investors, he recalls, the wrong assumption that low oil prices threaten solar was surprisingly widespread. “I received a bunch of questions saying, ‘Isn’t solar going to do worse because oil prices are down?’ Or some variation thereof, or questions where that was a premise. So I said, ‘This makes no sense. You can’t substitute oil for solar. Even at this cheap price of oil, oil would be a more expensive way to generate electricity than solar.’ The solar industry just keeps growing even though the price of oil is down.”

To prove he was right, Kreamer examined the historical data and found no correlation between low oil prices and either the price of electric generation or the growth of solar. “This relationship [between oil and solar] has existed in the stock market but makes no sense in terms of the fundamentals,” says Kreamer. As he noted in a blog post on his study, “It costs less to make electricity from solar than it does from oil at $50 per barrel. Even at $30 per barrel, solar still wins. Public equity investors are getting this trade wrong.”

One greentech sector that could be hurt by low oil prices is clean cars — electric, fuel cell, and hybrid. They cost more than conventional automobiles, but save owners money on gasoline. The less gasoline costs, the less incentive there is to shell out for one. Tesla, the electric car manufacturer, has seen a decline in its stock price from $238 to $199 per share over the last three months. (Still, its price is up from $175 a year ago, reflecting the longer-term growth pattern for greentech stocks.)

The solar decline isn’t entirely due to cluelessness. A lot of the shareholders dumping their stocks in solar companies and driving the price down aren’t individuals selling their shares in one particular company. They’re institutional investors reducing their holdings in the energy sector as a whole. “Energy is treated as one thing,” says Kann. “So if oil prices go down and you want to get out of energy, you sell and solar becomes collateral damage.”

And there are some actual threats to the solar market on the horizon. “It very well may be that the investors are looking not at what’s happening today but what will happen in the future,” says Adam Browning, executive director of Vote Solar, a pro-solar advocacy organization. Dirty energy interests and pro–fossil fuel politicians are threatening to kneecap the U.S. solar industry just as it gets up and running. At the state level, the American Legislative Exchange Council, a right-wing industry-funded policy shop, is joining many utilities in trying to kill renewable portfolio standards and net-metering policies that make solar arrays more affordable for homeowners. And more importantly, the national solar investment tax credit, which allows anyone from a homeowner to a utility to deduct 30 percent of the cost of buying a solar system from their tax bill, expires at the end of 2016.

But right now, it’s more likely that investors are confused rather than far-sighted. Closer to its expiration date, uncertainty about the tax credit’s future could lead to uncertainty about the solar industry and drag on solar stock prices. But it is not a forgone conclusion that the credit won’t be extended. While congressional Republicans won’t want to do it, if they cannot keep their right-wing members on board for the annual tax-extenders package and need Democratic votes (which is what happened in 2014), then they may have to give the Democrats renewable energy credits in exchange for what they want, such as various loopholes that benefit fossil fuel companies.

No matter how that plays out, the long-term outlook for solar looks strong. As the industry matures, it becomes less reliant on incentives. The California Solar Initiative, for example, offered high rebates for solar panel purchases in 2007 and progressively lower rebates each year thereafter, as the industry has grown. Now, California’s solar installers have achieved the scale needed to thrive without government support. Nationally, Browning adds, the price of a solar array has declined so much that many people will buy one even without the federal tax credit.

Solar also has strong long-range prospects because its input is constantly improving technology rather than a vanishing natural resource. Despite the current glut of oil and gas, fossil fuels will eventually get more expensive as their finite supplies shrink, but solar just keeps getting cheaper. And renewables offer better price stability than fossil fuels. A cold snap, for example, can send gas and oil prices through the roof, since they are used for heating as well as electricity. As Devashree Saha and Mark Muro, a pair of Brookings Institution policy analysts, noted in a blog post last week:

A recent energy cost analysis by investment firm Lazard confirms that the cost of energy from utility-scale solar and wind farms has become widely competitive with electricity produced from conventional fuels like coal, natural gas, and nuclear, even without subsidies in some markets — with the cost of utility-scale solar falling 80 percent and wind energy falling 60 percent in the last five years.

On the other hand, commodities-based sources, which are finite and expensive to locate, extract, ship, and refine, are inherently subject to price volatility. … And no one knows for sure how long the [shale] production boom will last, with the U.S. Energy Information Administration projecting that even under favorable conditions U.S. shale oil production will peak by 2020 and then decline. …

Oil prices can only go up while most clean energy technologies are only at the beginning of a rapid price decline due to manufacturing and efficiency improvements.

If you take an even longer view, solar will eventually be an even better bet. The more governments move to price carbon, factoring climate change into the cost of fossil fuels, the more competitive clean energy will be. It will be many years before Democrats retake Congress and pass a national carbon tax or cap-and-trade system, but even just the EPA’s regulations of CO2 emissions from coal plants will make coal more expensive and solar therefore more appealing.

So smart investors won’t be deterred from buying solar shares. As Kann observes, “There’s something sort of dumb happening here. People who know what’s going on have already suggested this is a buying opportunity for solar stocks.”