Filtering device having a casing which defines a through-flow space for a liquid to be filtered and is provided with at least two connectors (13, 14a 14b) for connection to a pipe, designed to place the latter in fluid communication with said space; said space comprising a magnetic filtering chamber, which communicates with a first one of said connectors (13, 14a 14b), and a mechanical filtering chamber, which communicates with a second one (14a, 14b) of said connectors (13, 14a, 14b) and which has a through-flow opening communicating with said magnetic filtering chamber so that a fluid that crosses said space, entering via a first one of the connectors (13, 14a 14b) and flowing out from the second one (14a, 14b) of the connectors (13, 14a 14b), or, vice versa, crosses in succession both said chambers (15, 16); wherein said magnetic filtering chamber has a magnetic member which extends, with its operating end, towards said through-flow opening, said magnetic member being designed to emit a magnetic field inside the magnetic filtering chamber; said mechanical filtering chamber houses a mesh filter which divides up said chamber into a first part, communicating with said through-flow opening, and a second part, which communicates with said second connector (14a, 14b) so that such a fluid flow passing between said through-flow opening and said connector is forced to cross said mesh filter; wherein the operating end is arranged spaced from said through-flow opening so that an accumulation of particulate matter on said operating end does not hinder the through-flow of liquid from said magnetic filtering chamber to said mechanical filtering chamber, across said through-flow opening, characterized in that said magnetic filtering chamber has a bottom wall, a discharge duct which faces said bottom wall where said magnetic member extends between said bottom wall and said operating end towards said through-flow opening; wherein the second part of said mechanical filtering chamber has a discharge outlet and said filtering device comprises means for closing said discharge outlet which are configured so that they can be operated from the outside of said filtering device in order to open or close said discharge outlet; wherein following opening of said discharge outlet, the latter is connected to said magnetic filtering chamber so as to discharge into the latter material which has accumulated in the second part of said mechanical filtering chamber following filtering by said mesh filter. wherein said magnetic filtering chamber has a magnetic member which extends, with its operating end, towards said through-flow opening, said magnetic member being designed to emit a magnetic field inside the magnetic filtering chamber; said mechanical filtering chamber houses a mesh filter which divides up said chamber into a first part, communicating with said through-flow opening, and a second part, which communicates with said second connector (14a, 14b) so that such a fluid flow passing between said through-flow opening and said connector is forced to cross said mesh filter; wherein the operating end is arranged spaced from said through-flow opening so that an accumulation of particulate matter on said operating end does not hinder the through-flow of liquid from said magnetic filtering chamber to said mechanical filtering chamber, across said through-flow opening, characterized in that said magnetic filtering chamber has a bottom wall, a discharge duct which faces said bottom wall where said magnetic member extends between said bottom wall and said operating end towards said through-flow opening;