My top stock in the oil industry right now, Apache Corporation (APA -0.74%), is set to report second-quarter 2017 earnings on Aug. 3, and it's predicted to underperform its first-quarter results as its production drops. That's in contrast to its larger rival, ConocoPhillips (COP -0.93%), which just reported decent second-quarter results. But don't let that fool you: Apache has made some incredibly smart moves in 2017, so much so that the second half of the year is looking much rosier than the first.

Here are the best moves the company has made in the last several months and why they should lead to a reversal of the stock's recent downward trend. 

Oil wells in silhouette at sunset

Oil and gas industry player Apache has been ignored by the stock market despite making some excellent decisions in 2017. Image source: Getty Images.

Saying goodbye to Canada

There are more than a few good reasons to visit our neighbor to the north, poutine and Tim Hortons donuts among them. Cheap oil and gas production, though, isn't. While some companies have been able to get competitive returns out of the resource-intensive heavy crude and bitumen that come from Canadian oil sands, Apache was never one of them, and neither was Conoco.

Investors rewarded Conoco for selling off most of its Canadian assets to rival Cenovus in March, which gave the company some needed cash to reduce its debt load and buy back shares. In June, Apache followed suit, selling some of its assets to the Canadian Cardinal Energy and others to an undisclosed private company. Then, in July, Apache decided to exit the country entirely, selling its Apache Canada Ltd. subsidiary to Paramount Resources Ltd. 

Unlike Conoco, though, Apache's stock didn't jump after any of these transactions were announced. But that doesn't mean they won't be good for investors. Apache will net $713 million from the three transactions, which management plans to use to reduce debt, improve liquidity, or fund a portion of the company's capital expenditure plan. It is also planning to re-deploy the unspent portion of the $125 million in Canadian capital expenditures to other projects. This is fortunate, as the company has a good number of projects right now that could use the cash.

Investing in Alpine High

Apache is focusing its exploration and production efforts on three areas: the North Sea in the U.K., Egypt, and the Permian Basin in Texas. Specifically, the company needs to build out the infrastructure at its massive new "Alpine High" find in West Texas. Because of industry misconceptions about how much oil and gas were in that section of the Permian Basin, Apache has basically had to start from scratch developing the area. 

The company could have taken it slow, ramping up production and infrastructure over a period of years. Instead, Apache decided to ramp up its Alpine High operations less than a year from its announcement of the find. It devoted $500 million of its 2017 capital expenditures (16.2%) to Alpine High alone and an additional $1.5 billion (48.4%) to the Permian Basin generally.

These full-bore efforts have paid off, with Alpine High development proceeding under budget and ahead of schedule. In fact, it anticipates it will accelerate some of its 2018 capital plans into 2017 with no corresponding increase in expenditures. With the additional unused capital money from the Canadian divestment, Apache should have no problem getting Alpine High online in the third quarter as promised. 

Keeping eggs in other baskets

With such a promising find in Alpine High -- and initial wells have shown the field to be more promising than expected, not less -- Apache's management might have been justified in putting all of its eggs in the Alpine High basket, to the exclusion of other parts of its portfolio. 

Instead, the company is investing more, not less, in its overseas operations. In the North Sea, for example, it is installing a major subsea tieback that will start oil flowing from its promising Callater field. This resulted in some downtime in the North Sea during the second quarter -- one of the reasons that second-quarter production is expected to decline.

In Egypt, Apache was granted two new land concessions in the Western Desert -- where Apache already holds significant acreage -- in December 2016. Management decided to initiate a new 3D seismic survey to explore its new concessions as well as its existing 3 million undeveloped acres. 

Investor takeaway

A lot of things seem to be going Apache's way right now, which is why I recently bought shares in the company. Better yet -- at least, for potential investors -- these brilliant moves haven't really moved the stock price, which is trading near its 10-year lows at less than $50 per share. 

The company reports earnings on Aug. 3, and the projected lackluster second-quarter performance may cause shares to slip even further, which would represent an excellent buying opportunity. But even at today's prices, given all that's going right for the company, Apache looks like a bargain.