A flow meter for measuring a fluid, comprising: - a measuring tube with a measuring piston movably arranged in said measuring tube , and elements for changing the direction of movement of the measuring piston in said measuring tube , wherein said measuring piston , when measuring, is designed to be moved in said measuring tube under the influence of said fluid, and - sensor elements for detecting movement of the piston and the direction of movement in said measuring tube , and for detecting when the piston is situated in at least one of its reversing areas before the measuring piston has reached the extreme point of the reversing area, so as to afford a substantially continuous flow detection for said fluid, wherein said sensor elements for detecting the movement of the piston and the direction of the movement consist of an optical encoder, wherein the optical encoder comprises an encoder strip , wherein said encoder strip comprises code elements in the form of slits with a first distance between said slits, and wherein the encoder strip runs along a second encoder element with stationary slits , the flow meter further comprising elements which, when it has been detected that the piston is situated in at least one of its reversing areas , change the direction of movement of the piston before the measuring piston has reached the extreme point of said reversing area, wherein said encoder strip runs between a first optical transmitter and a first receiver arranged on the opposite side, and wherein said encoder strip runs between a second optical transmitter and a second receiver arranged on the opposite side, wherein a first signal that is generated by said first transmitter/receiver is arranged to have a phase offset relative to a second signal that is generated by said second transmitter/receiver. - a measuring tube with a measuring piston movably arranged in said measuring tube , and elements for changing the direction of movement of the measuring piston in said measuring tube , wherein said measuring piston , when measuring, is designed to be moved in said measuring tube under the influence of said fluid, and - sensor elements for detecting movement of the piston and the direction of movement in said measuring tube , and for detecting when the piston is situated in at least one of its reversing areas before the measuring piston has reached the extreme point of the reversing area, so as to afford a substantially continuous flow detection for said fluid, wherein said sensor elements for detecting the movement of the piston and the direction of the movement consist of an optical encoder, wherein the optical encoder comprises an encoder strip , wherein said encoder strip comprises code elements in the form of slits with a first distance between said slits, and wherein the encoder strip runs along a second encoder element with stationary slits , the flow meter further comprising elements which, when it has been detected that the piston is situated in at least one of its reversing areas , change the direction of movement of the piston before the measuring piston has reached the extreme point of said reversing area, wherein said encoder strip runs between a first optical transmitter and a first receiver arranged on the opposite side, and wherein said encoder strip runs between a second optical transmitter and a second receiver arranged on the opposite side, wherein a first signal that is generated by said first transmitter/receiver is arranged to have a phase offset relative to a second signal that is generated by said second transmitter/receiver. <EOS>