Device for measuring the linear component in a given direction (D) of the movement of a rail (R) when a train passes, comprising: - a light barrier which is fixedly joined to the track infrastructure and which is insulated from the impacts of trains passing on the rail and which is formed by at least one transmitter of a light beam to a corresponding receiver , - an index which is fixedly joined to the movement of the rail (R), the device being characterised in that the index is formed by a succession of active zones of a given spacing (d), the active zones being opaque or reflective zones which intersect the beam and which are separated by transparent zones, this index being placed in the light beam in order to cooperate with the beam , the index cooperating with the beam via the displacement movement (ΔH) of the rail (R) via the active zones which alternately intersect the beam in order to generate a succession of interaction signals (SCi) of the beam in the corresponding receiver , the device further being characterised in that it comprises - an operating device which receives the interaction signals (SCi) of the receiver in order to count them by movement sequence of the rail, this counting corresponding to the linear component of the relative displacement movement (ΔH) of the rail starting from the rest position of the index . - a light barrier which is fixedly joined to the track infrastructure and which is insulated from the impacts of trains passing on the rail and which is formed by at least one transmitter of a light beam to a corresponding receiver , - an index which is fixedly joined to the movement of the rail (R), the device being characterised in that the index is formed by a succession of active zones of a given spacing (d), the active zones being opaque or reflective zones which intersect the beam and which are separated by transparent zones, this index being placed in the light beam in order to cooperate with the beam , the index cooperating with the beam via the displacement movement (ΔH) of the rail (R) via the active zones which alternately intersect the beam in order to generate a succession of interaction signals (SCi) of the beam in the corresponding receiver , the device further being characterised in that it comprises the device being characterised in that the index is formed by a succession of active zones of a given spacing (d), the active zones being opaque or reflective zones which intersect the beam and which are separated by transparent zones, this index being placed in the light beam in order to cooperate with the beam , the index cooperating with the beam via the displacement movement (ΔH) of the rail (R) via the active zones which alternately intersect the beam in order to generate a succession of interaction signals (SCi) of the beam in the corresponding receiver , the device further being characterised in that it comprises - an operating device which receives the interaction signals (SCi) of the receiver in order to count them by movement sequence of the rail, this counting corresponding to the linear component of the relative displacement movement (ΔH) of the rail starting from the rest position of the index . <EOS>