Treadmill distance is calculated as number of steps times stride length.
If you were holding hand rail with fitbit hand, steps might not be detected because the wrist is held steady and can not detect steps, usually detected by the normal swinging of arms while walking.
If you can hold rail with one arm, that will work. If not, you can put tracker in pocket or pinned to clothing and probably get decent step count, and thus distance, but at the loss of heart rate data for that time.
Best Answer