Trailing Stops - TraderPlan/wiki GitHub Wiki

How Trailing Stops Work in TraderPlan

How the Order Price is Calculated

Example 1 (current market price is above your original price in your trail)

Original Price: USD 617.02
Best Price: USD 619.01
Opening a ASK limit order for on ETH ... @ 619.01 USD

Example 2 (current market price has moved below your original price in your trail)

Original Price: USD 617.02
Best Price: USD 590.00
Opening a ASK limit order for on ETH ... @ 617.02 USD

What the Trailing Stop Messages Mean

In this example, we've set the trailing stop at 5% of the price.

Phase 1: Opening Trail Stop Order

When a trailing stop order is first activated, you might see the below message:

Opening a trailing stop ASK order for 0.01000000 LTC @ 137.5 USDT which is 1.37500000 USDT and trailing by 6.875 USDT.
ASK Trailing stop for 0.01000000 of LTC/USDT moved on Bittrex. Was 123.75, is now 131.31250001. Best price is presently: 137.50000000

Since the price is 137.5 USDT, the trailing by amount is 137.5 * 5% = 6.875 USDT.

The Was price is calculated as bestPrice - 2 * trailingBy = 137.5 - 2 * 6.875 = 123.75. This represents the previous trailingBy amount. When it's first activated (i.e. no previous trailing stop order existed), this amount will be meangingless.

The is now price is bestPrice - trailingBy * 0.9 - 0.00000001 = 137.5 - 6.875 * 0.9 - 0.00000001 = 131.3125. If we are in allocation mode, we add 0.00000001 instead of subtracting it.

Phase 2: Activating Exchange Order

If the highest bid price drops to 128.07 USDT, then that will displayed as the best price. However, because the best price is less than your starting target, the bot uses the highest of the two, which is 137.5 when placing an exchange order.

ASK Trailing stop for LTC/USDT at Bittrex activated for [email protected], best price is 128.07000000, starting target was 137.50000000.
Bittrex: Opening a ASK limit order on LTC for 0.01000000 @ 137.50000000 LTC/USDT which is 1.375 USDT.