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

PropTypeDefaultDescription
percentnumber0.5The trailing profit percentage
percentBelownumber0.1The trailing profit percentage below
ticksnumber1The trailing profit ticks
ticksBelownumber1The trailing profit ticks below
transmitbooleantrueTransmit the algorithm
modestringallThe 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

On this page