fix: Remove fallback that breaks TP2-as-runner system
- Change tp2SizePercent fallback from || 100 to ?? 0 - Allows 0 value to pass through (means 'activate trailing stop, don't close') - Fixes bug where TP2 was closing 100% of remaining position - Now correctly leaves 25% runner after TP1 closes 75% - Applied to both execute and test endpoints
This commit is contained in:
@@ -258,8 +258,8 @@ export async function POST(request: NextRequest): Promise<NextResponse<TestTrade
|
||||
tp1Price,
|
||||
tp2Price,
|
||||
stopLossPrice,
|
||||
tp1SizePercent: config.takeProfit1SizePercent || 50,
|
||||
tp2SizePercent: config.takeProfit2SizePercent || 100,
|
||||
tp1SizePercent: config.takeProfit1SizePercent ?? 75,
|
||||
tp2SizePercent: config.takeProfit2SizePercent ?? 0, // 0 = activate trailing stop, don't close
|
||||
direction: direction,
|
||||
// Dual stop parameters
|
||||
useDualStops: config.useDualStops,
|
||||
|
||||
Reference in New Issue
Block a user