Trailing Stop
Trailing Stop dynamically raises (for longs) or lowers (for shorts) the stop loss as price moves in your favour. The stop follows the highest observed price at a configurable distance — either as a percentage of that price or as a fixed number of price units. The stop never moves backward.
Algorithm
The high-water mark is stored per-node and persists across ticks. It resets automatically when the graph restarts or the position closes.
Parameters
| Parameter | Default | Description |
|---|---|---|
| trailingDistance | 2.0 | Distance from the high-water mark to the stop level. Interpreted as % when usePercentage is true, otherwise as price units. |
| usePercentage | true | When true, trailingDistance is a percent of the highest price. When false, it is a fixed absolute distance. |
| fixedDistance | 0 | Absolute distance used when usePercentage is false. Set to the desired price gap in your asset's native units. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Input | ||
| input | price series | Price series used to compute the high-water mark. Typically a close price or high price series. |
| Outputs | ||
| trailingStopPrice | number | null | Current trailing stop level in price units. Null if no price data yet. |
| trailingDistance | number | The configured trailing distance value (mirrors the parameter). |
| usePercentage | boolean | Whether percentage or fixed-distance mode is active. |
| highestPrice | number | null | The highest price observed since the node started running. |
| lowestPrice | number | null | The lowest price observed (tracked for short-side awareness). |
Use Cases
Trend ride with tight exit
Set trailingDistance = 2% on a trending stock. The stop follows every new high, locking in gains while allowing normal pullbacks without premature exit.
Volatile crypto position
Use a fixed distance of 200 USDT on a BTC position to accommodate larger intraday swings without getting stopped out, while still protecting a large open profit.
Combined with Break Even
Use Break Even first (move SL to entry) then let Trailing Stop take over — the two work in series to eliminate risk then maximise the captured move.