Trailing Take-Profit / DCA Trigger
The pos_price_change_follow trigger is a dynamic exit (or entry) that activates when price reaches a threshold from the position entry, then fires when price retraces by a tolerance amount. Use it for trailing take-profits that ride momentum before exiting, or trailing DCA that buys on a bounce after a dip.
TOML Syntax
[[actions.triggers]]
type = "pos_price_change_follow"
value = "3%" # Required: activation threshold from entry
tolerance = "-0.5%" # Required: retrace tolerance to trigger
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | — | Must be "pos_price_change_follow" |
value | string | Yes | — | Activation threshold: "±N%" from entry price |
tolerance | string | Yes | — | Retrace tolerance: how far price must pull back after activation |
max_count | integer | No | unlimited | Maximum times this trigger can fire per position |
pos_price_change_follow does not support the timeframe field. It tracks price relative to the position entry, like pos_price_change.
How It Works
This trigger has two phases:
Phase 1: Activation
The trigger activates when the position's P&L reaches the value threshold:
- Positive
value(e.g.,"3%"): activates when position is up 3% from entry - Negative
value(e.g.,"-10%"): activates when position is down 10% from entry
Phase 2: Retrace and Fire
Once activated, the trigger tracks the extreme price (highest for positive, lowest for negative) and fires when price retraces from that extreme by the tolerance amount:
- Negative
tolerance(e.g.,"-0.5%"): fires when price drops 0.5% from the tracked peak - Positive
tolerance(e.g.,"1%"): fires when price rises 1% from the tracked low
graph TD
A["Position P&L<br/>reaches threshold"] --> B["Phase 1: Activated"]
B --> C["Track extreme price<br/>(highest or lowest)"]
C --> D{"Price retraces<br/>by tolerance?"}
D -->|Yes| E["Trigger fires"]
D -->|No| F["Update extreme<br/>if new high/low"]
F --> D
Trailing Take-Profit Example
With value = "3%" and tolerance = "-0.5%":
- Position opens at $100
- Price rises to $103 → activation (up 3% from entry)
- Price continues to $108 (tracked peak = $108)
- Price drops to $107.46 → that's -0.5% from $108 → trigger fires
The trailing take-profit rode the run from $103 to $108, then exited on a small retrace. A fixed take-profit at 3% would have sold at $103 and missed the extra 5%.
Trailing DCA Example
With value = "-10%" and tolerance = "1%":
- Position opens at $100
- Price drops to $90 → activation (down 10% from entry)
- Price continues dropping to $85 (tracked low = $85)
- Price rises to $85.85 → that's +1% from $85 → trigger fires
Instead of buying at exactly -10%, the trailing DCA waited for the price to show signs of recovery (bouncing 1% from the local bottom) before adding capital.
Examples
Trailing Take-Profit: Sell on Retrace from Profit
[[actions]]
type = "sell"
amount = "100%"
[[actions.triggers]]
type = "pos_price_change_follow"
value = "3%"
tolerance = "-0.5%"
Trailing DCA: Buy on Bounce After Deep Dip
[[actions]]
type = "buy"
amount = "100%"
average_price = true
[[actions.triggers]]
type = "pos_price_change_follow"
value = "-10%"
tolerance = "1%"
Full Strategy: Multi-Signal Entry + Trailing Exit
[meta]
name = "StochRSI Trailing"
description = "StochRSI extreme entry + trailing take-profit exit"
max_open_positions = 1
# Entry: StochRSI deeply oversold
[[actions]]
type = "open_long"
amount = "100 USDC"
[[actions.triggers]]
indicator = "stoch_rsi_14"
operator = "<"
target = "20"
timeframe = "15m"
[[actions.triggers]]
indicator = "rsi_14"
operator = "<"
target = "35"
timeframe = "15m"
# Exit: trailing take-profit
[[actions]]
type = "sell"
amount = "100%"
[[actions.triggers]]
type = "pos_price_change_follow"
value = "3%"
tolerance = "-0.5%"
# DCA: trailing buy after deep dip shows recovery
[[actions]]
type = "buy"
amount = "100%"
average_price = true
[[actions.triggers]]
type = "pos_price_change_follow"
value = "-10%"
tolerance = "1%"
Choosing the Right Parameters
| Use Case | value | tolerance | Behavior |
|---|---|---|---|
| Tight trailing TP | "2%" | "-0.2%" | Quick exit after small gain |
| Wide trailing TP | "5%" | "-1%" | Rides larger runs, accepts bigger retrace |
| DCA on bounce | "-10%" | "1%" | Buys after deep dip shows 1% recovery |
| DCA on slight bounce | "-5%" | "0.5%" | Buys after moderate dip with slight recovery |
Tips
pos_price_change_follow is more sophisticated than a plain trailing_stop. The trailing stop tracks from peak; pos_price_change_follow only activates after a threshold is reached and then has a separate tolerance for exit. This gives you more control over when trailing begins.
For trailing take-profits, use a small negative tolerance (e.g., "-0.5%"). For trailing DCA buys, use a small positive tolerance (e.g., "1%"). The tolerance sign depends on which direction you are watching for a retrace.
If your tolerance is too tight (e.g., "-0.1%"), normal price fluctuations will trigger the exit almost immediately after activation. Give enough room for the price to breathe.
Related Triggers
| Trigger | What It Measures |
|---|---|
| Trailing Stop | Simple trailing from peak (no activation threshold) |
| Position Price Change | Fixed % from entry price |
| Time in Position | Duration-based exit |