diff --git a/.env b/.env index 2d5f880..d9713ce 100644 --- a/.env +++ b/.env @@ -100,7 +100,7 @@ HARD_STOP_PERCENT=-2.5 # Take Profit 1: Close X% of position at this profit level (FALLBACK) # Example: +0.8% on 10x = +8% account gain -TAKE_PROFIT_1_PERCENT=1.1 +TAKE_PROFIT_1_PERCENT=1.45 # Take Profit 1 Size: What % of position to close at TP1 # 60 = close 60%, leave 40% for runner @@ -135,8 +135,8 @@ ATR_MULTIPLIER_SL=3.0 # Safety bounds (prevent extreme values) # TP1 bounds -MIN_TP1_PERCENT=1.1 # Clamp TP1 to requested 1.1% -MAX_TP1_PERCENT=1.1 # Clamp TP1 to requested 1.1% +MIN_TP1_PERCENT=1.45 # Clamp TP1 to requested 1.1% +MAX_TP1_PERCENT=1.45 # Clamp TP1 to requested 1.1% # TP2 bounds MIN_TP2_PERCENT=1 diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 70d3da0..d340fb3 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -103,21 +103,27 @@ - **Last Updated:** Dec 26, 2025 (indicator score bypass added) ### Position Management & Exit Strategy -- **Active System:** TP2-as-Runner with ATR-Based Dynamic Targets +- **Active System:** Fixed TP1 with ATR-Based TP2/Trailing - **File:** `lib/trading/position-manager.ts` (2,027 lines) - **Status:** ✅ PRODUCTION - **Exit Flow:** - 1. TP1 at ATR × 2.0 (~0.86%) → Close 60% (configurable via `TAKE_PROFIT_1_SIZE_PERCENT`) + 1. TP1 at **1.45% FIXED** → Close 100% (Jan 3, 2026 - MIN/MAX clamped to 1.45%) 2. Move SL to breakeven (ADX-based: 0% for ADX<20, -0.55% for ADX>25) 3. TP2 at ATR × 4.0 (~1.72%) → Activate trailing stop (does NOT close position) 4. Trailing Stop: ATR × 1.5 with real-time 1-min ADX adjustments + profit acceleration - 5. Runner (40% default) exits via trailing stop or emergency SL + 5. Runner exits via trailing stop or emergency SL +- **TP1 Configuration (Jan 3, 2026):** + * `TAKE_PROFIT_1_PERCENT=1.45` (target) + * `MIN_TP1_PERCENT=1.45` (floor - prevents going below) + * `MAX_TP1_PERCENT=1.45` (cap - prevents going above) + * `TAKE_PROFIT_1_SIZE_PERCENT=100` (close entire position at TP1) + * Rationale: User-requested fixed 1.45% TP1, no ATR variance - **Key Features:** * Adaptive trailing: Widens for strong ADX (>30), tightens for weak (<25) * ADX acceleration bonus: +5 points since entry = 1.3× wider trail * Peak tracking: Updates `peakPrice` every 2s for precise trailing calculations - **Critical Bug Fixed:** Bug #87 - State persistence (tp2Hit, trailingStopActive, peakPrice) now bulletproof -- **Last Updated:** Dec 17, 2025 (state persistence fix - commit 341341d) +- **Last Updated:** Jan 3, 2026 (TP1 fixed to 1.45%) ### Adaptive Leverage System - **Status:** ❌ DISABLED (Jan 2, 2026) - Using fixed leverage (SOL 10x, ETH 5x) diff --git a/config/trading.ts b/config/trading.ts index a92993a..6867dec 100644 --- a/config/trading.ts +++ b/config/trading.ts @@ -154,7 +154,7 @@ export const DEFAULT_TRADING_CONFIG: TradingConfig = { // Risk parameters (LEGACY FALLBACK - used when ATR unavailable) stopLossPercent: -2.8, // Fallback: -2.8% if no ATR - takeProfit1Percent: 1.1, // Fallback: +1.1% if no ATR + takeProfit1Percent: 1.45, // Fallback: +1.45% if no ATR takeProfit2Percent: 1.8, // Fallback: +1.8% if no ATR emergencyStopPercent: -2.0, // Emergency hard stop (always active) @@ -163,8 +163,8 @@ export const DEFAULT_TRADING_CONFIG: TradingConfig = { atrMultiplierTp1: 2.0, // TP1 = ATR × 2.0 (Example: 0.45% ATR = 0.90% TP1) atrMultiplierTp2: 4.0, // TP2 = ATR × 4.0 (Example: 0.45% ATR = 1.80% TP2) atrMultiplierSl: 3.0, // SL = ATR × 3.0 (Example: 0.45% ATR = 1.35% SL) - minTp1Percent: 1.1, // Floor: Never below +1.1% - maxTp1Percent: 1.1, // Cap: Fixed at +1.1% + minTp1Percent: 1.45, // Floor: Never below +1.45% + maxTp1Percent: 1.45, // Cap: Fixed at +1.45% minTp2Percent: 1.0, // Floor: Never below +1.0% maxTp2Percent: 3.0, // Cap: Never above +3.0% minSlPercent: 2.8, // Floor: Never tighter than -2.8%