diff --git a/.env b/.env index f3ecf27..4763b71 100644 --- a/.env +++ b/.env @@ -147,7 +147,7 @@ MAX_SL_PERCENT=2.0 # Never wider than -2.0% # Emergency Stop: Hard stop if this level is breached # Example: -2.0% on 10x = -20% account loss (rare but protects from flash crashes) -EMERGENCY_STOP_PERCENT=-2 +EMERGENCY_STOP_PERCENT=-20 # Dynamic stop-loss adjustments # Move SL to breakeven when profit reaches this level @@ -174,7 +174,7 @@ MIN_TIME_BETWEEN_TRADES=1 # DEX execution settings # Maximum acceptable slippage on market orders (percentage) # Example: 1.0 = accept up to 1% slippage -SLIPPAGE_TOLERANCE=0.15 +SLIPPAGE_TOLERANCE=0.1 # How often to check prices (milliseconds) # Example: 2000 = check every 2 seconds diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index d4654df..2e086cc 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -78,7 +78,7 @@ - BTC and other symbols fall back to global settings (`MAX_POSITION_SIZE_USD`, `LEVERAGE`) - **Priority:** Per-symbol ENV → Market config → Global ENV → Defaults -**Signal Quality System:** Filters trades based on 5 metrics (ATR, ADX, RSI, volumeRatio, pricePosition) scored 0-100. Only trades scoring 81+ are executed (raised from 60 on Nov 21, 2025 after v8 proving 94.2 avg quality with 66.7% win rate). Scores stored in database for future optimization. +**Signal Quality System:** Filters trades based on 5 metrics (ATR, ADX, RSI, volumeRatio, pricePosition) scored 0-100. Only trades scoring 91+ are executed (raised from 81 on Nov 21, 2025 after trade #7: ADX 19.0 weak-trend loss at quality 90). v8 averaging 93.6 quality with 57.1% win rate - threshold raised to filter borderline ADX entries. Scores stored in database for future optimization. **Timeframe-Aware Scoring:** Signal quality thresholds adjust based on timeframe (5min vs daily): - 5min: ADX 12+ trending (vs 18+ for daily), ATR 0.2-0.7% healthy (vs 0.4%+ for daily) @@ -1087,7 +1087,7 @@ const driftSymbol = normalizeTradingViewSymbol(body.symbol) **Key endpoints:** - `/api/trading/execute` - Main entry point from n8n (production, requires auth), **auto-caches market data** -- `/api/trading/check-risk` - Pre-execution validation (duplicate check, quality score, **per-symbol cooldown**, rate limits, **symbol enabled check**, **saves blocked signals automatically**) +- `/api/trading/check-risk` - Pre-execution validation (duplicate check, quality score ≥91, **per-symbol cooldown**, rate limits, **symbol enabled check**, **saves blocked signals automatically**) - `/api/trading/test` - Test trades from settings UI (no auth required, **respects symbol enable/disable**) - `/api/trading/close` - Manual position closing (requires symbol normalization) - `/api/trading/sync-positions` - **Force Position Manager sync with Drift** (POST, requires auth) - restores tracking for orphaned positions diff --git a/config/trading.ts b/config/trading.ts index 02061dd..192200d 100644 --- a/config/trading.ts +++ b/config/trading.ts @@ -157,7 +157,7 @@ export const DEFAULT_TRADING_CONFIG: TradingConfig = { trailingStopActivation: 0.5, // Activate trailing when runner is +0.5% in profit // Signal Quality - minSignalQualityScore: 81, // Minimum quality score for initial entry (raised from 60 on Nov 21, 2025 - v8 averaging 94.2 with 66.7% WR) + minSignalQualityScore: 91, // Raised to 91 on Nov 21, 2025 after trade #7 (ADX 19.0 weak trend, quality 90, -$387 loss) - v8 averaging 93.6 with 57.1% WR // Position Scaling (conservative defaults) enablePositionScaling: false, // Disabled by default - enable after testing