Primitives
trailingProfit
Trailing profit algorithm, close position when profit is above or below a certain percentage or ticks, with below options, you can set a trailing stop to close position when profit is below a certain percentage or ticks
trailingProfit (position)
Trailing profit algorithm, close position when profit is above or below a certain percentage or ticks, with below options, you can set a trailing stop to close position when profit is below a certain percentage or ticks
Input parameters
| Prop | Type | Default | Description |
|---|---|---|---|
| percent | number | 0.5 | The trailing profit percentage |
| percentBelow | number | 0.1 | The trailing profit percentage below |
| ticks | number | 1 | The trailing profit ticks |
| ticksBelow | number | 1 | The trailing profit ticks below |
| transmit | boolean | true | Transmit the algorithm |
| mode | string | all | The mode of the algorithm, run all histories or just latest, gte, lte |
SQL example
--- transmit=false manually
IF POS trailingProfit ticks=15 ticksBelow=5 transmit=false
TICK profitTicks > 10 THEN trailingProfit SET transmit=true
--- or transmit=true by default
IF POS trailingProfit ticks=15 ticksBelow=5