Stocks rose in volatile trading on Tuesday. The Dow Jones Industrial Average (^DJI 0.56%) gained 24 points or 0.1%, and the S&P 500 (^GSPC -0.88%) rose 6 points, or 0.3%:

^DJI Chart

^DJI data by YCharts.

In economic news, Federal Reserve Chair Janet Yellen testified to Congress about "considerable uncertainty" around the outlook for economic growth both at home and abroad.

Beyond tepid job gains in the U.S. recently, Yellen highlighted a few global risks, including the slowing Chinese economy and a potential UK vote to leave the European Union as some of the many reasons that Fed officials are only expecting to make gradual changes to interest rates over the next few years.

Meanwhile, stocks making notable moves today included CarMax (KMX 0.63%), OSI Systems (OSIS 1.26%), and American Science and Engineering (ASEI).

CarMax's traffic problem

Used automobile retailer CarMax fell 5% following second-quarter earnings results that revealed lower than expected sales and profit figures. Revenue ticked up by 3% to $4.1 billion thanks to a growing store base, but the company endured its third straight quarter of declining customer traffic.

The good news is that a slightly higher percentage of those shoppers became buyers, and so comparable-store sales growth was flat despite the traffic drop.

Image source: Getty Images.

Profits held steady on a per-vehicle basis, an encouraging sign given the booming new-car market. The bigger store footprint pushed overall costs higher, though, which hurt profitability. CarMax's net margin dipped to 4.2% of sales from 4.5%, as it generated $175 million of net income compared with $182 million in the year-ago period.

Overall, these results show that the retailer is still operating in a challenging sales environment. CarMax has a big opportunity to expand its presence into the 30% of the country that it doesn't yet serve. It made progress on that goal this quarter, establishing itself in Springfield, Ill., and San Francisco, Calif. Yet the stock isn't likely to recover as long as customer traffic at existing locations remains weak.

OSI Systems gets more secure

OSI Systems rose 9% on news that it is purchasing American Science and Engineering Inc. (ASEI) for $200 million, sending those shares up 14%. The move will bolster its security division that produces a range of inspection and scanning systems. That segment accounted for 49% of the business last year, with optical electronics and healthcare splitting the remaining portion. Going forward, security will now take up 55% of the combined company that should produce nearly $1 billion in annual sales.

Image source: Getty Images.

OSIS CEO Deepak Chopra called the deal "the most significant security acquisition in our company's history." Chopra highlighted ASEI's leading X-ray technology, strong service network, and attractive customer base. "[ASEI] represents an excellent strategic fit consistent with our expansion strategy," he added.

Debt will play a big role in this purchase. In fact, OSIS executives project that the debt load will more than double to 2.1 times adjusted annual earnings. Management believes that level isn't too high, given what they're getting out of the deal. "The combination creates new opportunities for revenue and profit growth while maintaining a flexible and conservative balance sheet," Chief Financial Officer Alan Edrick said.