US stock indexes shake off an early loss and close higher

US stocks reversed course from an early slump and closed higher Thursday to break a two-day losing streak after technology and bank stocks rallied. Corporate earnings are in full swing and investors have been cautiously assessing results and company statements. The volatile market is still on track for a weekly loss despite the S&P 500 opening the week with a record high close. The pullback has barely dented the big gains made by every major index this year, including a 19.5 percent rise for the S&P 500 index. The latest batch of results are providing a better picture of the economy after months of ups and downs in the market because of policy concerns and lingering trade disputes. ‘‘We’ve been watching the game and now we actually get to see the scorecard,’’ said Brad McMillan, chief investment officer for Commonwealth Financial Network. The results so far have reflected financial strength from banks as the broader economy holds up with solid job growth and consumer confidence. ‘‘The consumers are still making things happen out there and it’s showing up in the earnings to a surprising degree,’’ he said.