docs: Document TRAILING_SL exit reason distinction in copilot instructions

Added comprehensive documentation for the trailing SL feature:
- Exit reason tracking: Regular SL vs TRAILING_SL distinction
- Detection logic: tp2Hit + trailingStopActive + price pullback check
- Database storage: TRAILING_SL as separate exitReason value
- Analytics UI: Purple styling with runner emoji for trailing stops
- Code locations: Position Manager (3 locations) + Analytics frontend
- Implementation date: Nov 24, 2025 (commit 9d7932f)

Purpose: Enable separate analysis of runner trailing stop performance
vs early hard stop losses for optimization insights.
This commit is contained in:
mindesbunister
2025-11-24 08:50:13 +01:00
parent 9d7932ff2f
commit c09201ccde

View File

@@ -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)