The invention provides a deflecting fence type square heat exchanger with a waved tube. The heat exchanger comprises a case, a heat exchange tube, an upper tube plate and a lower tube plate, wherein the case, the upper tube plate and the lower tube plate form airtight space, an airtight upper head is arranged on the left side of the upper tube plate, an airtight lower head is arranged on the right side of the lower tube plate, a tube-side inlet is arranged on the upper head, a tube-side outlet is arranged on the lower head, the heat exchange tube is installed in the airtight space, two ends of the heat exchange tube are installed in the upper tube plate and the lower tube plate respectively and communicated with the upper head and the lower head respectively, a tube-side outlet tube is arranged on the right of the upper tube plate on the case, a tube-side inlet tube is arranged on the left of the lower tube plate, and a deflecting fence for supporting the heat exchange tube is mounted in the case and comprises a deflecting ring and a support rod installed in the deflecting ring. According to the heat exchanger, vortex flow and the Venturi effect can occur when shell pass fluid flows through the square deflecting fence, so that the shell pass fluid can obtain good turbulent current conditions, dead flow zones and leakage current losses when the fluid flows across tube bundles are reduced, and heat exchange on the shell side is strengthened.