Profit Maximization

Trailing Stop Loss

Let your profits run while protecting gains. Our intelligent TSL system follows price movements upward and sells only when the trend reverses.

Combine TSL with DCA Strategy for optimized entries

What is TSL?

Trailing Stop Loss is an intelligent sell strategy that dynamically adjusts your stop-loss price as the market moves in your favor. Unlike a fixed take-profit that sells at a predetermined price, TSL tracks the highest price and sells only when the price drops by a configured percentage from that peak.

Problem with Classic TP

You buy at $100, set TP at $110 (+10%)
Price reaches $110 → Sold!
Price continues to $150...
Result: You missed $40 potential profit!

Solution with TSL

You buy at $100, set TP at $110, TSL-Drop at 3%
Price reaches $110 → TSL ACTIVATED (not sold!)
Price rises to $150 → TSL trails to $145.50
Price drops to $145 → NOW sold!
Result: +$45 instead of +$10!

Interactive TSL Simulator

Visualize how TSL maximizes your profits

Configuration

Simulation Results

Buy Order
Position opened
Price: $100.00ATH: $100.00
TSL Initialized
Activation: $110.00
Price: $100.00ATH: $100.00TSL: $106.70
Price Reaches TP
TSL ACTIVATED
Price: $110.00ATH: $110.00TSL: $106.70
Price Rises to Peak
ATH Updated
Price: $150.00ATH: $150.00TSL: $145.50
Price Drops
TSL TRIGGERED
Price: $142.50ATH: $150.00TSL: $145.50
TP Mode Result
$10.00
+10.00%
TSL Mode Result
$42.50
+42.50%
TSL Advantage:
$32.50 (+32.50%)

TSL captured additional profit by letting the position run!

Real-World Case Studies

See TSL in action across different market scenarios

Bull Run Scenario

Strong upward trend with gradual profit-taking

Buy: $50,000
TP: $55,000
TSL Drop: 3%
TP Mode Profit
$5,000
Sell @ $55,000
TSL Mode Profit
$12,980
Sell @ $62,980
Difference
+$7,980
TSL advantage

Two Operating Modes

TSL Mode (Trailing Stop Loss)trailingStopLossPercentages = [3]

Dynamic stop-loss that follows price upward

{
  "buySplits": 3,
  "sellPercentages": [10, 20, 30],
  "trailingStopLossPercentages": [3, 5, 7]
}
Split 1: TSL activates at +10%, sells when price drops 3% from ATH
Split 2: TSL activates at +20%, sells when price drops 5% from ATH
Split 3: TSL activates at +30%, sells when price drops 7% from ATH

Advantages

  • Maximizes profits in bull runs
  • Automatic adaptation to rising prices
  • "Lets profits run" while securing gains

Disadvantages

  • May result in lower sell price on quick reversals
  • Requires careful drop percentage selection
  • Uses MARKET orders (potential slippage)

The Three Phases of TSL

1

Waiting for Activation

State: tslActive = false

TSL is "armed" but not yet active. System monitors market price and waits for price to reach activation point (TP price).

2

ATH Tracking

State: tslActive = true, price rising

Each new high updates the ATH and pulls the TSL price upward. TSL price can never decrease, only increase!

3

Trigger & Sell

State: price <= tslPrice

When price falls to or below TSL price, a MARKET order is placed for immediate exit.

The Formula

TSL Price = ATH x (1 - Drop% / 100)

Example with 3% Drop: If ATH = $150, then TSL = $150 x 0.97 = $145.50

Time-Based TSL Adjustment

v8.7.0+

In real markets, it can be beneficial to adjust the TSL drop over time. Shortly after buying, use a tighter TSL to secure gains. After hours, loosen the TSL to tolerate more volatility.

sellTimeCurves: {
  "10": [
    { after: "0",   percent: 10, tslPercent: 3 },
    { after: "1h",  percent: 10, tslPercent: 5 },
    { after: "4h",  percent: 10, tslPercent: 8 },
    { after: "24h", percent: 8,  tslPercent: 10 }
  ]
}

Safety Mechanisms

Built-in protections to prevent errors and losses

Minimum TSL Price (Safety Clamp)

TSL will never be set below buy price + 1 tick. This prevents selling at a loss even with high drop percentages.

Notional Check

Before triggering, system verifies the order value meets exchange minimum (e.g., $5). If too small, TSL is permanently disabled.

Race Condition Prevention

Atomic claim mechanism prevents multiple processes from triggering the same sell order simultaneously.

Memory Lock

Additional in-memory lock for legacy compatibility ensures no duplicate processing within the same instance.

TP Mode vs TSL Mode

AspectTP ModeTSL Mode
Sell PriceFixed (TP price)Dynamic (ATH - Drop%)
Profit PotentialLimited to TPTheoretically unlimited
RiskNone (guaranteed TP)Lower sell on reversal
Order TypeLIMITMARKET
Best ForSideways markets, quick tradesBull runs, strong trends

Log Reference

Understanding TSL log messages

[TSL-INIT]

TSL was initialized when order was created

[TSL-ACTIVATED]

TSL was activated (price >= activation price)

[TSL-UPDATE]

ATH was updated, TSL price pulled up

[TSL-TRIGGER]

TSL was triggered (price <= TSL price)

[TSL-SAFETY]

Safety clamp was applied

[TSL-RACE-PREVENTION]

Double trigger was prevented

[REPRICE-TSL]

TSL was adjusted based on time

[TSL-EXECUTION]

Market sell order was placed

Ready to Maximize Your Profits?

Configure TSL in your trading bot and let your profits run while protecting your gains automatically.