A method of detecting the reciprocal position between a cylinder and a piston in a cylinder-piston unit, said method comprising the steps of: - arranging a cylinder-piston unit including: ∘ at least one tubular body having at least one through receiving seat; ∘ at least one moving body longitudinally translatable in said tubular body, said moving body being provided with at least one reference area extending for a portion on the surface of said moving body, along the longitudinal axis of said moving body; ∘ at least detecting means, receivable in said through receiving seat of said tubular body, faced towards said moving body in said tubular body, and designed to detect the presence or absence of said reference area at a detection area thereof, and to generate at least one corresponding output electrical signal, in response to the detection or not of said reference area of said moving body; ∘ at least one program control and processing unit, designed to receive in input said at least one output electrical signals from said detecting means and to generate in output at least one electrical signal of detection; - activating said detecting means (step 100); - processing, by said at least one program control and processing unit, said at least one signals output from said detecting means (step 200), said processing step including a comparison (step 220) between said at least one output electrical signal and respective maximum and minimum reference threshold values (S max, S min); - generating, based on said processing (step 200) an electrical signal of detection by said at least one program control and processing unit (step 300); characterized by the fact that said maximum and minimum reference threshold values (S max, S min) are calculated based on average values of the amplitudes of a plurality of sample of said one output electrical signal and periodically updateable according to the following relationships: S min = average in reference area + average in absence reference area − hysteresis / 2 S max = average in reference area + average in absence reference area + hysteresis / 2 wherein said "hysteresis" is a predetermined value, said "average in reference area" corresponds to the average value of the amplitudes of said plurality of samples of said signal detected at said reference area, and said "average in absence reference area" corresponds to the average value of the amplitudes of said plurality of samples of said signal detected at an area outside said reference area. - arranging a cylinder-piston unit including: ∘ at least one tubular body having at least one through receiving seat; ∘ at least one moving body longitudinally translatable in said tubular body, said moving body being provided with at least one reference area extending for a portion on the surface of said moving body, along the longitudinal axis of said moving body; ∘ at least detecting means, receivable in said through receiving seat of said tubular body, faced towards said moving body in said tubular body, and designed to detect the presence or absence of said reference area at a detection area thereof, and to generate at least one corresponding output electrical signal, in response to the detection or not of said reference area of said moving body; ∘ at least one program control and processing unit, designed to receive in input said at least one output electrical signals from said detecting means and to generate in output at least one electrical signal of detection; ∘ at least one tubular body having at least one through receiving seat; ∘ at least one moving body longitudinally translatable in said tubular body, said moving body being provided with at least one reference area extending for a portion on the surface of said moving body, along the longitudinal axis of said moving body; ∘ at least detecting means, receivable in said through receiving seat of said tubular body, faced towards said moving body in said tubular body, and designed to detect the presence or absence of said reference area at a detection area thereof, and to generate at least one corresponding output electrical signal, in response to the detection or not of said reference area of said moving body; ∘ at least one program control and processing unit, designed to receive in input said at least one output electrical signals from said detecting means and to generate in output at least one electrical signal of detection; - activating said detecting means (step 100); - processing, by said at least one program control and processing unit, said at least one signals output from said detecting means (step 200), said processing step including a comparison (step 220) between said at least one output electrical signal and respective maximum and minimum reference threshold values (S max, S min); - generating, based on said processing (step 200) an electrical signal of detection by said at least one program control and processing unit (step 300);