Smart SL/TP Configuration User Guide

Overview

The Smart SL/TP (Stop Loss / Take Profit) system provides advanced risk management with dynamic trailing, breakeven protection, and adaptive scaling features. This guide covers configuration and optimized settings for different trading styles.

Configuration Parameters

Basic Settings

SLTPSettings:
  StopLossPercent: 0.0          # Base SL distance from TP (%)
  TakeProfitPercent: 0.0        # Base TP distance from entry (%)

Trailing Stop Loss

  EnableTrailingSl: false              # Enable dynamic SL trailing
  TrailingSlOffsetPercent: 0.5         # Distance below current price (%)

How it works:

  • SL automatically moves up (long) or down (short) as price moves favorably
  • Only moves in profitable direction - never worse than previous position
  • Locks in profits while allowing position to grow

Breakeven Protection

  EnableBreakeven: false                  # Enable breakeven mode
  BreakevenActivationPercent: 1.0        # Trigger at X% profit
  BreakevenBufferPercent: 0.2            # Small buffer above/below entry

How it works:

  • When price reaches activation threshold, SL moves to entry + buffer
  • Protects against losses after reaching initial profit target
  • Buffer prevents premature stop-out from minor retracements

Trailing Take Profit

  EnableTrailingTp: false                 # Enable TP trailing
  TrailingTpTriggerPercent: 2.0          # Start trailing at X% profit
  TrailingTpOffsetPercent: 0.5           # Distance above current price (%)

How it works:

  • TP trails current price once trigger threshold is reached
  • Captures larger moves while protecting downside
  • When TP is hit, it automatically converts to a Stop Loss order

Dynamic Trailing Scaling

  EnableDynamicTrailingScaling: false    # Enable adaptive offsets
  TrailingScalingMap:
    "1.0": 0.5    # At 1% profit, use 0.5% offset
    "2.0": 0.4    # At 2% profit, use 0.4% offset
    "3.0": 0.3    # At 3% profit, use 0.3% offset
    "5.0": 0.25   # At 5% profit, use 0.25% offset
    "10.0": 0.2   # At 10% profit, use 0.2% offset

How it works:

  • Offset tightens as profit increases
  • Locks in more profit during extended moves
  • System uses the first threshold that current profit exceeds

Optimized Settings by Trading Style

1. Scalp Trading (High Frequency, Small Profits)

Objective: Quick entries/exits, tight risk management, capture small moves

SLTPSettings:
  StopLossPercent: 2.0
  TakeProfitPercent: 1.5
  
  # Tight trailing for quick profit locking
  EnableTrailingSl: true
  TrailingSlOffsetPercent: 0.3
  
  # Quick breakeven activation
  EnableBreakeven: true
  BreakevenActivationPercent: 0.5
  BreakevenBufferPercent: 0.1
  
  # No trailing TP (exit at target)
  EnableTrailingTp: false
  
  # Tight dynamic scaling
  EnableDynamicTrailingScaling: true
  TrailingScalingMap:
    "0.5": 0.3
    "1.0": 0.2
    "2.0": 0.15

Key Features:

  • Very tight trailing (0.3%)
  • Fast breakeven at 0.5% profit
  • Aggressive scaling for quick profit protection
  • Fixed TP to ensure quick exits

2. Day Trading (Intraday Swings)

Objective: Capture intraday volatility, moderate risk/reward, active management

SLTPSettings:
  StopLossPercent: 3.0
  TakeProfitPercent: 3.0
  
  # Moderate trailing
  EnableTrailingSl: true
  TrailingSlOffsetPercent: 0.5
  
  # Breakeven at reasonable profit
  EnableBreakeven: true
  BreakevenActivationPercent: 1.0
  BreakevenBufferPercent: 0.2
  
  # Enable TP trailing for extended moves
  EnableTrailingTp: true
  TrailingTpTriggerPercent: 2.0
  TrailingTpOffsetPercent: 0.6
  
  # Balanced dynamic scaling
  EnableDynamicTrailingScaling: true
  TrailingScalingMap:
    "1.0": 0.5
    "2.0": 0.4
    "3.0": 0.3
    "5.0": 0.25

Key Features:

  • Balanced 3% SL/TP ratio (1:1 risk/reward)
  • Moderate trailing allows breathing room
  • TP trailing captures extended intraday moves
  • Dynamic scaling protects profits progressively

3. Swing Trading (Multi-Day Positions)

Objective: Capture larger trends, withstand volatility, maximize winners

SLTPSettings:
  StopLossPercent: 4.0
  TakeProfitPercent: 6.0
  
  # Wider trailing for volatility
  EnableTrailingSl: true
  TrailingSlOffsetPercent: 1.0
  
  # Conservative breakeven
  EnableBreakeven: true
  BreakevenActivationPercent: 2.0
  BreakevenBufferPercent: 0.3
  
  # Aggressive TP trailing
  EnableTrailingTp: true
  TrailingTpTriggerPercent: 4.0
  TrailingTpOffsetPercent: 1.0
  
  # Progressive tightening
  EnableDynamicTrailingScaling: true
  TrailingScalingMap:
    "2.0": 1.0
    "4.0": 0.8
    "6.0": 0.6
    "8.0": 0.5
    "10.0": 0.4

Key Features:

  • Wider stops for overnight volatility (1% trailing)
  • Higher profit target (1:1.5 risk/reward)
  • TP trails to capture extended trends
  • Progressive tightening locks in multi-day gains

4. Long-Term Position Trading

Objective: Capture major trends, minimal management, maximize asymmetric returns

SLTPSettings:
  StopLossPercent: 6.0
  TakeProfitPercent: 15.0
  
  # Very wide trailing
  EnableTrailingSl: true
  TrailingSlOffsetPercent: 2.0
  
  # Patient breakeven
  EnableBreakeven: true
  BreakevenActivationPercent: 5.0
  BreakevenBufferPercent: 0.5
  
  # Patient TP trailing
  EnableTrailingTp: true
  TrailingTpTriggerPercent: 10.0
  TrailingTpOffsetPercent: 2.0
  
  # Wide scaling for major moves
  EnableDynamicTrailingScaling: true
  TrailingScalingMap:
    "5.0": 2.0
    "10.0": 1.5
    "15.0": 1.0
    "20.0": 0.8
    "30.0": 0.5

Key Features:

  • Very wide stops (2% trailing) for long-term volatility
  • High profit targets (1:2.5 risk/reward)
  • Patient thresholds avoid premature exits
  • Scales down gradually to protect large gains

Advanced Configuration Tips

1. Risk/Reward Optimization

Conservative (1:2 or better):

StopLossPercent: 2.0
TakeProfitPercent: 4.0

Balanced (1:1 to 1:1.5):

StopLossPercent: 3.0
TakeProfitPercent: 3.0-4.5

Aggressive (1:1 or lower):

StopLossPercent: 4.0
TakeProfitPercent: 4.0

2. Volatility Adjustments

Low Volatility Markets:

  • Reduce TrailingSlOffsetPercent (0.2-0.4%)
  • Tighter breakeven activation (0.5-1.0%)
  • More aggressive scaling

High Volatility Markets:

  • Increase TrailingSlOffsetPercent (0.8-2.0%)
  • Wider breakeven buffer (0.3-0.5%)
  • More conservative scaling

3. Symbol-Specific Overrides

The system supports per-symbol settings that override global configuration. This is useful for:

  • Different volatility characteristics
  • Varying liquidity profiles
  • Asset-specific strategies

4. Dynamic Scaling Strategy

Tight Scaling (Scalping):

TrailingScalingMap:
  "0.5": 0.3
  "1.0": 0.2
  "1.5": 0.15

Wide Scaling (Position Trading):

TrailingScalingMap:
  "5.0": 2.0
  "10.0": 1.5
  "20.0": 1.0
  "30.0": 0.5

System Behavior

Stop Loss Logic

  1. Initial Placement: Calculated based on TP distance and risk percentage
  2. Trailing Activation: Moves as price advances favorably
  3. Breakeven Trigger: Locks in entry price + buffer when activated
  4. Dynamic Scaling: Tightens offset as profit increases
  5. Direction Lock: SL only moves in profitable direction (never backwards)

Take Profit Logic

  1. Initial Placement: Set at entry + target percentage
  2. Trailing Trigger: Activates after reaching trigger threshold
  3. TP Trailing: Follows price at specified offset
  4. TP Hit Conversion: Converts to SL when price reaches TP
  5. Direction Lock: TP only moves in profitable direction

Update Frequency

  • System checks every 5 seconds
  • Updates are applied atomically
  • Exchange orders modified with retry logic (3 attempts)
  • Rate limited to prevent API overload (max 10 concurrent calls)

Best Practices

1. Start Conservative

  • Begin with wider stops and standard scaling
  • Tighten gradually based on performance data
  • Test in demo mode first

2. Match Market Conditions

  • Adjust trailing offsets for current volatility
  • Use wider stops in ranging markets
  • Tighten in strong trending conditions

3. Monitor Performance

  • Track hit rates for SL vs TP
  • Analyze average profit per trade
  • Adjust scaling thresholds based on typical move sizes

4. Consider Fees

  • Trailing modifications may trigger multiple order updates
  • Factor in exchange fees when setting tight trails
  • Balance optimization vs. transaction costs

5. Risk Management

  • Never disable SL entirely (always use > 0%)
  • Set TP percentage appropriate for timeframe
  • Use breakeven to protect capital after initial profit

Troubleshooting

SL/TP Not Updating

  • Check that percentages are > 0
  • Verify trailing is enabled
  • Ensure price is moving favorably
  • Check logs for validation errors

Premature Stop-Outs

  • Increase TrailingSlOffsetPercent
  • Widen breakeven buffer
  • Adjust scaling thresholds higher

Missing Profit Extensions

  • Enable TrailingTp
  • Lower TrailingTpTriggerPercent
  • Increase TrailingTpOffsetPercent

Configuration Errors

  • Validate YAML syntax
  • Ensure all percentages are positive
  • Check scaling map keys are valid decimals
  • Review startup logs for validation messages

Summary

The Smart SL/TP system provides enterprise-grade risk management with:

  • ✅ Dynamic trailing for both SL and TP
  • ✅ Automatic breakeven protection
  • ✅ Adaptive scaling based on profit
  • ✅ Symbol-specific customization
  • ✅ Robust error handling and retries
  • ✅ Efficient state management

Choose settings that match your trading style, monitor performance, and adjust based on market conditions for optimal results.

📎 Related Topics