feat: ATR-based trailing stop + rate limit monitoring
MAJOR FIXES: - ATR-based trailing stop for runners (was fixed 0.3%, now adapts to volatility) - Fixes runners with +7-9% MFE exiting for losses - Typical improvement: 2.24x more room (0.3% → 0.67% at 0.45% ATR) - Enhanced rate limit logging with database tracking - New /api/analytics/rate-limits endpoint for monitoring DETAILS: - Position Manager: Calculate trailing as (atrAtEntry / price × 100) × multiplier - Config: TRAILING_STOP_ATR_MULTIPLIER=1.5, MIN=0.25%, MAX=0.9% - Settings UI: Added ATR multiplier controls - Rate limits: Log hits/recoveries/exhaustions to SystemEvent table - Documentation: ATR_TRAILING_STOP_FIX.md + RATE_LIMIT_MONITORING.md IMPACT: - Runners can now capture big moves (like morning's $172→$162 SOL drop) - Rate limit visibility prevents silent failures - Data-driven optimization for RPC endpoint health
This commit is contained in:
@@ -64,6 +64,14 @@ TAKE_PROFIT_2_PERCENT=1.5
|
||||
# Move SL to breakeven when profit reaches this level
|
||||
BREAKEVEN_TRIGGER_PERCENT=0.4
|
||||
|
||||
# ATR-based Trailing Stop (for 25% runner after TP2)
|
||||
# Trailing distance = (ATR × multiplier)
|
||||
# Example: 0.5% ATR × 1.5 = 0.75% trailing (more room than fixed 0.3%)
|
||||
TRAILING_STOP_ATR_MULTIPLIER=1.5
|
||||
TRAILING_STOP_MIN_PERCENT=0.25
|
||||
TRAILING_STOP_MAX_PERCENT=0.9
|
||||
TRAILING_STOP_ACTIVATION=0.5
|
||||
|
||||
# Risk limits
|
||||
# Stop trading if daily loss exceeds this amount (USD)
|
||||
MAX_DAILY_DRAWDOWN=-50
|
||||
|
||||
Reference in New Issue
Block a user