A position detector for a mobile pin, the pin being carried by an edge belonging to a pivoting sash or to a frame of a framework such as a door, window or shutter, the detector comprising: - a housing, which is attached to the edge; - a rod, which comprises a sensing end, extending outside the housing, and an inner end, extending inside the housing, the sensing end and the inner end being traversed by a longitudinal axis of the housing, the rod being configured to be moved in translation with respect to the housing along the longitudinal axis, in a translational path by the action of the pin on the sensing end, the translational path comprising a plurality of distinct ranges of positions of the rod, at least one of those ranges constituting a critical range; - sensors, contained in the housing, each sensor having a state whose value varies as a function of the translation of the rod, each range being associated with at least one of the sensors, in that the state of that sensor is affected when the rod is positioned in that range, the critical range being associated with at least one critical sensor (99A, 99B; 99C), among the sensors; and - an electronic analyser, which detects in which range the rod is positioned, according to values taken by the respective state of the sensors; characterised in that, for each critical range, the electronic analyser is configured to perform a detection of a change in the direction of translation of the rod with respect to the housing, along the longitudinal axis, while the rod is positioned in said critical range, the electronic analyser performing the detection on the basis of the values of the state of said at least one critical sensor (99A, 99B; 99C) associated with said critical range. - a housing, which is attached to the edge; - a rod, which comprises a sensing end, extending outside the housing, and an inner end, extending inside the housing, the sensing end and the inner end being traversed by a longitudinal axis of the housing, the rod being configured to be moved in translation with respect to the housing along the longitudinal axis, in a translational path by the action of the pin on the sensing end, the translational path comprising a plurality of distinct ranges of positions of the rod, at least one of those ranges constituting a critical range; - sensors, contained in the housing, each sensor having a state whose value varies as a function of the translation of the rod, each range being associated with at least one of the sensors, in that the state of that sensor is affected when the rod is positioned in that range, the critical range being associated with at least one critical sensor (99A, 99B; 99C), among the sensors; and - an electronic analyser, which detects in which range the rod is positioned, according to values taken by the respective state of the sensors; characterised in that, for each critical range, the electronic analyser is configured to perform a detection of a change in the direction of translation of the rod with respect to the housing, along the longitudinal axis, while the rod is positioned in said critical range, the electronic analyser performing the detection on the basis of the values of the state of said at least one critical sensor (99A, 99B; 99C) associated with said critical range.