Date: 202103
Local time of day: 0601-1200
Location: ZZZ.TRACON, US
Aircraft: Commercial Fixed Wing
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Initial Approach
Airspace: Class E ZZZ
ATC / advisory: TRACON ZZZ
Second aircraft: Any Unknown or Unlisted Aircraft Manufacturer
Reporter organization: Air Carrier
Reporter function: Pilot Flying; First Officer
Reporter qualification: Flight Crew Instrument; Flight Crew Multiengine; Flight Crew Air Transport Pilot (ATP)
Human factors: Situational Awareness; Training / Qualification; Communication Breakdown
Anomaly: Conflict Airborne Conflict; Deviation - Speed All Types; Deviation - Track / Heading All Types; Deviation / Discrepancy - Procedural Clearance; Deviation / Discrepancy - Procedural Published Material / Policy
Detector: Person Air Traffic Control
When detected: In-flight
Result: Air Traffic Control Issued Advisory / Alert; Flight Crew Became Reoriented
Contributing factors: Environment - Non Weather Related; Human Factors
Primary problem: Human Factors

Narrative: We were level 5;000 feet 250 knots approaching ZZZ VOR on the ZZZZZ2 Star. Approach gave a heading 280 and slow to 180 and asked if we had the field in sight.  We were heading 330 and I was thinking a turn to 350 was coming so 280 heading caught me a little off guard. I (FO) was pilot flying. The sun was just above the horizon as I looked west and across the cockpit for the field.  Simultaneously I was looking cross-cockpit and programing the speed and heading change into the FMC. I could make out the field so I said to the Captain (PM); 'I can see the field; you can call it in sight.'  I noticed another aircraft on TCAS at our altitude on TCAS and then saw them visually less than ten miles away; also headed west toward ZZZ [Airport]; I noted the  paint scheme and relayed to the PM all that information and that they were probably headed to the north side of the airport.  In my head I was thinking that our airplane was not slowing down as fast as I would like when the PM said 'where is that airplane; I think we need to turn.' I pushed the localizer button on the FMC but the airplane did not turn so I turned the autopilot off and manually turned to intercept final for [Runway] XXR. As I did; we received at TCAS TA then a few seconds later a TCAS RA to climb.  The ADI showed a red boxed area from level flight down (I was descending) so I just leveled off until we heard 'clear of conflict.'   Then Approach gave us a 180 heading; paused; and then said 'you guys can't do that;' and switched us to Tower.  I was able to correct the high energy level of the airplane using gear; flaps; and speed brakes and continued the approach and landed uneventfully.Fast close to the airfield; sun in eyes; failure on my part to use automation.Something from ATC that I was going to turn towards the runway instead of downwind in the [Runway] XXR pattern or an advisory where we were in the sequence.  My recency of experience led to not arming the localizer; while I did brief that at the start of the first leg I could have reemphasized it during the approach brief.




Synopsis: Air Carrier First Officer reported a track heading deviation and an altitude deviation during approach resulting in an RA event and cited lack of flying contributed to the event.