feat: Phase 2 Smart Entry Timing - COMPLETE

Implementation of 1-minute data enhancements Phase 2:
- Queue signals when price not at favorable pullback level
- Monitor every 15s for 0.15-0.5% pullback (LONG=dip, SHORT=bounce)
- Validate ADX hasn't dropped >2 points (trend still strong)
- Timeout at 2 minutes → execute at current price
- Expected improvement: 0.2-0.5% per trade = ,600-4,000 over 100 trades

Files:
- lib/trading/smart-entry-timer.ts (616 lines, zero TS errors)
- app/api/trading/execute/route.ts (integrated smart entry check)
- .env (SMART_ENTRY_* configuration, disabled by default)

Next steps:
- Test with SMART_ENTRY_ENABLED=true in development
- Monitor first 5-10 trades for improvement verification
- Enable in production after successful testing
This commit is contained in:
mindesbunister
2025-11-27 11:40:23 +01:00
parent cecdb8290c
commit a8c1b2ca06
4 changed files with 711 additions and 1 deletions

21
.env
View File

@@ -420,6 +420,27 @@ USE_PERCENTAGE_SIZE=false
BREAKEVEN_TRIGGER_PERCENT=0.4
ATR_MULTIPLIER_FOR_TP2=2
# ================================
# SMART ENTRY TIMING (Phase 2 - Nov 27, 2025)
# ================================
# Wait for optimal pullback within 2 minutes after 5-min signal
# Expected impact: 0.2-0.5% better entry per trade = $1,600-4,000 over 100 trades
SMART_ENTRY_ENABLED=false # Set to true to enable smart entry timing
SMART_ENTRY_MAX_WAIT_MS=120000 # 120,000ms = 2 minutes max wait
SMART_ENTRY_PULLBACK_MIN=0.15 # 0.15% minimum pullback to consider
SMART_ENTRY_PULLBACK_MAX=0.50 # 0.50% maximum pullback (beyond = possible reversal)
SMART_ENTRY_ADX_TOLERANCE=2 # Max ADX drop allowed (2 points)
# How it works:
# - 5-min signal arrives at candle close
# - Bot waits up to 2 minutes for price to pullback
# - LONG: Waits for dip 0.15-0.5% below signal price
# - SHORT: Waits for bounce 0.15-0.5% above signal price
# - Validates ADX hasn't dropped >2 points
# - Timeout: Executes at market if no pullback within 2 minutes
ENABLE_AUTO_WITHDRAWALS=false
WITHDRAWAL_INTERVAL_HOURS=168
WITHDRAWAL_PROFIT_PERCENT=10