Add trailing stop feature for runner position + fix settings persistence
- Implemented trailing stop logic in Position Manager for remaining position after TP2 - Added new ActiveTrade fields: tp2Hit, trailingStopActive, peakPrice - New config settings: useTrailingStop, trailingStopPercent, trailingStopActivation - Added trailing stop UI section in settings page with explanations - Fixed env file parsing regex to support numbers in variable names (A-Z0-9_) - Settings now persist correctly across container restarts - Added back arrow navigation on settings page - Updated all API endpoints and test files with new fields - Trailing stop activates when runner reaches configured profit level - SL trails below peak price by configurable percentage
This commit is contained in:
16
.env
16
.env
@@ -97,15 +97,15 @@ TAKE_PROFIT_1_PERCENT=0.7
|
||||
|
||||
# Take Profit 1 Size: What % of position to close at TP1
|
||||
# Example: 50 = close 50% of position
|
||||
TAKE_PROFIT_1_SIZE_PERCENT=50
|
||||
TAKE_PROFIT_1_SIZE_PERCENT=75
|
||||
|
||||
# Take Profit 2: Close remaining 50% at this profit level
|
||||
# Example: +1.5% on 10x = +15% account gain
|
||||
TAKE_PROFIT_2_PERCENT=1.5
|
||||
TAKE_PROFIT_2_PERCENT=1.1
|
||||
|
||||
# Take Profit 2 Size: What % of remaining position to close at TP2
|
||||
# Example: 100 = close all remaining position
|
||||
TAKE_PROFIT_2_SIZE_PERCENT=50
|
||||
TAKE_PROFIT_2_SIZE_PERCENT=80
|
||||
|
||||
# Emergency Stop: Hard stop if this level is breached
|
||||
# Example: -2.0% on 10x = -20% account loss (rare but protects from flash crashes)
|
||||
@@ -113,13 +113,13 @@ EMERGENCY_STOP_PERCENT=-2
|
||||
|
||||
# Dynamic stop-loss adjustments
|
||||
# Move SL to breakeven when profit reaches this level
|
||||
BREAKEVEN_TRIGGER_PERCENT=0.7
|
||||
BREAKEVEN_TRIGGER_PERCENT=0.3
|
||||
|
||||
# Lock in profit when price reaches this level
|
||||
PROFIT_LOCK_TRIGGER_PERCENT=1.2
|
||||
PROFIT_LOCK_TRIGGER_PERCENT=1
|
||||
|
||||
# How much profit to lock (move SL to this profit level)
|
||||
PROFIT_LOCK_PERCENT=0.2
|
||||
PROFIT_LOCK_PERCENT=0.6
|
||||
|
||||
# Risk limits
|
||||
# Stop trading if daily loss exceeds this amount (USD)
|
||||
@@ -348,3 +348,7 @@ NEW_RELIC_LICENSE_KEY=
|
||||
# - v4/QUICKREF_PHASE2.md - Quick reference
|
||||
# - TRADING_BOT_V4_MANUAL.md - Complete manual
|
||||
# - PHASE_2_COMPLETE_REPORT.md - Feature summary
|
||||
|
||||
USE_TRAILING_STOP=true
|
||||
TRAILING_STOP_PERCENT=0.3
|
||||
TRAILING_STOP_ACTIVATION=0.5
|
||||
Reference in New Issue
Block a user