Widebody; Low Wing; 2 Turbojet Eng
Flight Crew Instrument; Flight Crew Multiengine; Flight Crew Air Transport Pilot (ATP)
ATC Issue All Types; Conflict NMAC
Flight Crew Took Evasive Action
Airspace Structure; Human Factors; Procedure
Climbing on the SID; Departure told us to stop our climb at 6;000 ft. instead of 7;000 due to traffic. We complied. Once we leveled off at 6;000 we saw 2 targets on TCAS at 12 o'clock; one at our altitude and one 500 ft. above around 6 miles away. The target at our altitude disappeared off the TCAS screen but the one at 6;500 was still there and caused a TA (Traffic Advisory). The target then got closer but the TCAS showed it at 400 ft. above and then finally gave us a Preventative RA (Resolution Advisory) where the top arc of the TCAS was red. We finally saw the traffic which passed on our right side. Got the 'Clear of conflict' announcement and reported the RA to ATC. VFR traffic transiting the airspace along with IFR traffic at altitudes [is] too close in my opinion. More vertical separation needed.
On departure; ATC issued a level off for traffic. [The] FO (First Officer) leveled off and turned on the autopilot. One aircraft indicated 500 ft. above and one co-altitude on TCAS. [The] FO and [the] Captain had one aircraft in sight when approximately 10 seconds later the TCAS issued a preventative RA (Resolution Advisory) commanding us not to climb; which we did not. One aircraft showed 400 ft. on TCAS. [The] FO initiated RA procedures and maintained altitude. We received [a] clear of conflict and notified ATC. Aircraft in close proximity possibly descending into us.
Flight Crew reported encountering an NMAC event during climb.