Regular exercise can prevent nightmares.
Experts at the University of Texas found that individuals who get an hour of physical activity per day sleep better at night.
Physical activity also cuts the amount of time that people spent in the rapid eye movement (REM) period of sleep - the time when they are most likely to have nightmares.
The results tally up with recommendations already made by doctors to stop bad dreams.
Sleep scientists at Stanford University say: "Regular exercise, yoga and meditation may also help reduce stress and improve sleep quality and in turn reduce chronic nightmares."
The study's co-author David Schyner says that the findings - and the use of the Fitbit device in the experiment - could have big implications for future pieces of research.
He said: "The world is your oyster now. You can use this device to study all manner of different sleep architecture data related to lifestyle - related to mood and mood disorders - in the field, not in a lab, that people might have thought was not possible previously."