Ultraluminous X-ray sources out toz~ 0.3 in the COSMOS field