This selfreversing valve is a directional valve with a self-switching spool that is hydraulically actuated and mounted on a subplate. The valve automatically changes the flow direction when the flow stops in either the A or B line, for example, when a cylinder reaches its end position. The switching process occurs independently of the pressure in the working lines.