docs: Document ADX-based adaptive runner SL system
Updated copilot-instructions.md with Nov 19, 2025 enhancement: Architecture Overview - Exit Strategy: - Added runner SL section with ADX-based positioning - Documented three-tier system: <20 (0%), 20-25 (-0.3%), >25 (-0.55%) - Explained rationale: Entry at candle close = natural pullbacks - Risk management: Only accept drawdown on strong trends - Example outcomes: ADX 18 → +$38.70, ADX 29 → +$22.20 worst case Position Manager Section: - Replaced "Dynamic SL adjustments: breakeven" with ADX-based logic - Implementation details: Checks trade.adxAtEntry in TP1 handler - Logging format: "🔒 ADX-based runner SL: 29.3 → -0.55%" - Data collection phase: 50-100 trades for threshold optimization - Noted TP1 default is 60% (not 75% - old value) Key points documented: - Adaptive vs fixed approach (capital preservation on weak trends) - Integration with ADX trailing stop multiplier (both trend-adaptive) - Natural retracement tolerance (entry at top requires -1% room) - Future optimization plan (adjust 20/25 thresholds based on data) Related commits: -66b2922: Implementation -7cf00cf: Fixed runner SL to -0.55% (replaced by ADX-based) -d09838d: ADX trailing stop multiplier
This commit is contained in:
20
.github/copilot-instructions.md
vendored
20
.github/copilot-instructions.md
vendored
@@ -50,6 +50,13 @@
|
||||
- Safety bounds: MIN/MAX caps prevent extremes
|
||||
- Falls back to fixed % if ATR unavailable
|
||||
- **Runner:** 40% remaining after TP1 (configurable via `TAKE_PROFIT_1_SIZE_PERCENT=60`)
|
||||
- **Runner SL after TP1:** ADX-based adaptive positioning (Nov 19, 2025):
|
||||
- ADX < 20: SL at 0% (breakeven) - Weak trend, preserve TP1 profit
|
||||
- ADX 20-25: SL at -0.3% - Moderate trend, some retracement room
|
||||
- ADX > 25: SL at -0.55% - Strong trend, full retracement tolerance
|
||||
- **Rationale:** Entry at candle close = always at top, natural -1% to -1.5% pullbacks common
|
||||
- **Risk management:** Only accept runner drawdown on high-probability strong trends
|
||||
- Worst case examples: ADX 18 → +$38.70 total, ADX 29 → +$22.20 if runner stops (but likely catches big move)
|
||||
- **Trailing Stop:** ATR-based with ADX multiplier (Nov 19, 2025 enhancement):
|
||||
- Base: ATR × 1.5 multiplier
|
||||
- **ADX-based widening (graduated):**
|
||||
@@ -498,9 +505,16 @@ await positionManager.addTrade(activeTrade)
|
||||
|
||||
**Key behaviors:**
|
||||
- Tracks `ActiveTrade` objects in a Map
|
||||
- **TP2-as-Runner system**: TP1 (configurable %, default 75%) → TP2 trigger (no close, activate trailing) → Runner (remaining %) with ATR-based trailing stop
|
||||
- Dynamic SL adjustments: Moves to breakeven after TP1, locks profit at +1.2%
|
||||
- **On-chain order synchronization:** After TP1 hits, calls `cancelAllOrders()` then `placeExitOrders()` with updated SL price at breakeven (uses `retryWithBackoff()` for rate limit handling)
|
||||
- **TP2-as-Runner system**: TP1 (configurable %, default 60%) → TP2 trigger (no close, activate trailing) → Runner (remaining 40%) with ATR-based trailing stop
|
||||
- **ADX-based runner SL after TP1 (Nov 19, 2025):** Adaptive positioning based on trend strength
|
||||
- ADX < 20: SL at 0% (breakeven) - Weak trend, preserve capital
|
||||
- ADX 20-25: SL at -0.3% - Moderate trend, some retracement room
|
||||
- ADX > 25: SL at -0.55% - Strong trend, full retracement tolerance
|
||||
- **Implementation:** Checks `trade.adxAtEntry` in TP1 handler, calculates SL dynamically
|
||||
- **Logging:** Shows ADX and selected SL: `🔒 ADX-based runner SL: 29.3 → -0.55%`
|
||||
- **Rationale:** Entry at candle close = top of candle, -1% to -1.5% pullbacks are normal
|
||||
- **Data collection:** After 50-100 trades, will optimize ADX thresholds (20/25) based on stop-out rates
|
||||
- **On-chain order synchronization:** After TP1 hits, calls `cancelAllOrders()` then `placeExitOrders()` with updated SL price (uses `retryWithBackoff()` for rate limit handling)
|
||||
- **ATR-based trailing stop with ADX multiplier (Nov 19, 2025):**
|
||||
- Base calculation: `(atrAtEntry / currentPrice × 100) × trailingStopAtrMultiplier`
|
||||
- **ADX-based widening:** Multiplier adjusted based on trend strength at entry
|
||||
|
||||
Reference in New Issue
Block a user