diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 16fcef3..face661 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -72,6 +72,22 @@ - **Benefits:** Regime-agnostic (adapts to bull/bear automatically), asset-agnostic (SOL vs BTC different ATR), trend-strength adaptive (wider trail for strong trends) - **Note:** All UI displays dynamically calculate runner% as `100 - TAKE_PROFIT_1_SIZE_PERCENT` +**Exit Reason Tracking (Nov 24, 2025 - TRAILING_SL Distinction):** +- **Regular SL:** Stop loss hit before TP2 reached (initial stop loss or breakeven SL after TP1) +- **TRAILING_SL:** Stop loss hit AFTER TP2 trigger when trailing stop is active (runner protection) +- **Detection Logic:** + * If `tp2Hit=true` AND `trailingStopActive=true` AND price pulled back from peak (>1%) + * Then `exitReason='TRAILING_SL'` (not regular 'SL') + * Distinguishes runner exits from early stops +- **Database:** Both stored in same `exitReason` column, but TRAILING_SL separate value +- **Analytics UI:** Trailing stops display with purple styling + 🏃 emoji, regular SL shows blue +- **Purpose:** Analyze runner system performance separately from hard stop losses +- **Code locations:** + * Position Manager exit detection: `lib/trading/position-manager.ts` line ~937, ~1457 + * External closure handler: `lib/trading/position-manager.ts` line ~927-945 + * Frontend display: `app/analytics/page.tsx` line ~776-792 +- **Implementation:** Nov 24, 2025 (commit 9d7932f) + **Per-Symbol Configuration:** SOL and ETH have independent enable/disable toggles and position sizing: - `SOLANA_ENABLED`, `SOLANA_POSITION_SIZE`, `SOLANA_LEVERAGE` (defaults: true, 100%, 15x) - `ETHEREUM_ENABLED`, `ETHEREUM_POSITION_SIZE`, `ETHEREUM_LEVERAGE` (defaults: true, 100%, 1x)