Flight Instructor reported a NMAC with another aircraft entering the pattern.
Synopsis
Flight Instructor reported a NMAC with another aircraft entering the pattern.
Narrative
There was several of us in the pattern doing touch and goes with our students. I was with my student landing/taking off Runway XX at ZZZ; when we got a radio call on frequency that stated '10 mile final Runway XY.' Another pilot in the pattern replied back we were all using Runway XX and there was several of us in the pattern. The pilot on final then said he would switch to Runway XX. I then stated we were on upwind. We were around 300 ft. and I noticed his aircraft straight in front of us slightly to the right; coming in extremely fast and extremely close to us. At this point I could not turn right and get out of the pattern as he was slightly to the right and I believe I would have had a mid air. I then made the decision to do a climbing left turn. As I was doing a climbing left turn he turned slightly right and nearly had another midair with him he was about 50 to 100 ft. from me. I finally got safe away from him. Another pilot in the pattern made a radio call to him; and then I made a radio call to him when I was at a safe altitude and distance; he then stated he did not see my aircraft.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.