From 255cf2dd8334eadded9c5a3d1632e84b58404088 Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Mon, 20 Apr 2026 19:49:44 -0500 Subject: [PATCH] Stop consistency calc once profitTarget is met When totalProfit >= profitTarget, set baseAmount = 0 so the min-day reservation block takes over. This returns effectiveMinDay ($150) for remaining mandatory days instead of climbing toward maxDay/consistency. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/trading-logic.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/trading-logic.ts b/lib/trading-logic.ts index aa3e0f0..28556b8 100644 --- a/lib/trading-logic.ts +++ b/lib/trading-logic.ts @@ -102,11 +102,14 @@ export function computeDailyTarget( // The min-day reservation block below handles any mandatory-day targeting. baseAmount = 0; path = 'reduced_day'; + } else if (totalProfit >= profitTarget) { + // Profit target already met — stop solving for consistency, let min-day reservation handle remaining days + baseAmount = 0; + path = 'reduced_day'; } else { const maxDay = Math.max(...qualifyingDays.map((d) => d.pnl)); const realTarget = maxDay / consistency; - // Need to satisfy BOTH consistency (realTarget) AND the actual profitTarget - const needed = Math.max(realTarget, profitTarget) - totalProfit; + const needed = realTarget - totalProfit; if (needed > maxDay) { baseAmount = maxDay;