Consider the below sketch:
Assume the desired direction is positive (i.e. a long position). As the price moves up towards the first peak, the stop-loss (bottom of the red indicator) follows, as expected. When the price starts coming down, the stop-loss remains static, again as expected.
BUT, when the price makes a very slight local maximum, which is what ALWAYS happens in markets, the stop-loss threshold gets updated! This is dangerous! This makes the trailing stop practically go up and down freely. I have already lost money due to this behavior at least a couple of times.
I suggest a better implementation, which realizes the main idea behind a trailing stop, would be this: “The stop-loss threshold only moves in the desired direction, AND NEVER IN THE OPPOSITE DIRECTION, whatsoever”.
I think this solves the problem and is what everybody needs.