Documentation/AlgoCode/Function reference

trail

Stop-loss movement for each trailing step.

Reference/Language/Language

trail 5 points or trail trailBy points

Write a number or input name. Pair with trailsteps to move the stop by this amount whenever price advances one trailing step. Without trailsteps, it keeps the legacy behavior of following the best price at this distance. Input-backed trail values accept decimals.

Return value

Example

when ema(9) crosses above ema(21)
  buy
stop 10 points
trailsteps 10 points
trail 5 points

See also