diff --git a/lib/trading/position-manager.ts b/lib/trading/position-manager.ts index 86bbb2c..a909f78 100644 --- a/lib/trading/position-manager.ts +++ b/lib/trading/position-manager.ts @@ -1061,15 +1061,29 @@ export class PositionManager { await this.executeExit(trade, this.config.takeProfit1SizePercent, 'TP1', currentPrice) trade.currentSize = trade.positionSize * ((100 - this.config.takeProfit1SizePercent) / 100) + + // ADX-based runner SL positioning (Nov 19, 2025) + // Strong trends get more room, weak trends protect capital + let runnerSlPercent: number + const adx = trade.adxAtEntry || 0 + + if (adx < 20) { + runnerSlPercent = 0 // Weak trend: breakeven, preserve capital + } else if (adx < 25) { + runnerSlPercent = -0.3 // Moderate trend: some room + } else { + runnerSlPercent = -0.55 // Strong trend: full retracement room + } + const newStopLossPrice = this.calculatePrice( trade.entryPrice, - this.config.profitLockAfterTP1Percent, // Lock profit on remaining position + runnerSlPercent, trade.direction ) trade.stopLossPrice = newStopLossPrice trade.slMovedToBreakeven = true - console.log(`🔒 SL moved to lock +${this.config.profitLockAfterTP1Percent}% profit (${this.config.takeProfit1SizePercent}% closed, ${100 - this.config.takeProfit1SizePercent}% remaining): ${newStopLossPrice.toFixed(4)}`) + console.log(`🔒 ADX-based runner SL: ${adx.toFixed(1)} → ${runnerSlPercent}% (${this.config.takeProfit1SizePercent}% closed, ${100 - this.config.takeProfit1SizePercent}% remaining): ${newStopLossPrice.toFixed(4)}`) // CRITICAL: Cancel old on-chain SL orders and place new ones at updated price // BUT: Only if this is the ONLY active trade on this symbol