CSX Corporation (CSX) has enjoyed a breathless rally in the last two years and has thus outperformed the market by a wide margin. During this period, the stock has rallied 138% whereas S&P has advanced 35%. The big question is whether there is further upside for the stock.

CSX provides rail, rail-to-truck, and intermodal transport services. The company started with 13 miles of track, which has grown to a current network of 21,000 miles across 23 states. Railroad stocks comprise an interesting group of stocks thanks to the strong competitive advantage they enjoy. As it is extremely costly to create a network of routes that connect various parts of the continent, there are essentially prohibitive barriers to entry to potential new competitors. As a result, railroad stocks enjoy a wide moat in their business.

CSX currently exhibits strong momentum thanks to favorable trends in its business. In Q2, the company exhibited strong growth in the revenues from almost all the freight categories. Moreover, thanks to its cost-cutting initiatives, it has managed to enhance its operating margin for four consecutive years, from 28.5% in 2014 to 35.6% this year. Furthermore, the company benefits from a meaningful decrease in its tax rate this year thanks to the recent tax reform. Overall, the company is poised to grow its earnings per share by more than 50% this year and post record earnings this and next year.

All the above factors help explain the relentless rally of the stock in the last two years. However, this rally has led the stock to trade at a current P/E ratio of 20.4, which is much higher than its 5-year average P/E of 16.9. On the one hand, the rich valuation can be partly justified by the strong momentum of the company. On the other hand, as soon as the company begins to decelerate, its P/E ratio is likely to contract towards its average historical level. If this occurs within the next three years, the stock will incur a 6.1% annualized drag due to P/E contraction. Consequently, investors should be aware of the significant downside risk of the stock whenever it faces unforeseen headwinds in the several freight categories it engages in.