Which strategy.exit parameters use prices or ticks?
Choose the units before writing the exit. A stop-loss and take-profit bracket uses stop and limit; it is not the stop-limit entry order created by strategy.entry with the same two argument names. The exit ID identifies the exit order, while from_entry must match the intended entry ID.
- In v6, stop/loss and limit/profit pairs also select the level expected to trigger first. Supply one member of each pair unless this selection is intentional.
- For a long trade, an active trail follows rising highs. For a short trade, it follows falling lows with the stop above price.
- Use math.max(1, math.round(distance / syminfo.mintick)) when the intended offset must be at least one whole tick. Rounding changes the requested distance by up to half a tick.
| Parameter | Unit | Meaning |
|---|---|---|
| stop | Absolute price | Stop-loss order level |
| limit | Absolute price | Take-profit order level |
| loss / profit | Ticks from entry | Relative stop-loss / take-profit distances |
| trail_points | Ticks from entry | Favorable movement required for activation |
| trail_price | Absolute price | Alternative activation level |
| trail_offset | Ticks | Distance from the favorable extreme after activation |