The earnings optimism helped investors look past fresh attacks between US and Iranian forces in the Gulf.