From c0d60dfe8d4375b7322a113af8a129ec07c0f4ee Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Mon, 20 Apr 2026 20:16:51 -0500 Subject: [PATCH] Simplify Mode A to compare equityProfit against profitTarget Previously Mode A computed effective target = profitTarget - (priorProfit + totalWithdrawals), which produced inflated targets after withdrawals. Since computeDailyTarget now uses equityProfit (amount - accountSize) directly, Mode A just needs to return the base profitTarget unchanged. The equity-based comparison naturally handles 'get back to same target above accountSize' semantics. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/trading-logic.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/trading-logic.ts b/lib/trading-logic.ts index c5bcd33..280f452 100644 --- a/lib/trading-logic.ts +++ b/lib/trading-logic.ts @@ -19,12 +19,10 @@ export function resolveEffectiveConfig( fundTransactions: { date: string; amount: number }[] ): { profitTarget: number; consistency: number; minTradingDays: number } { if (targetSameEquity) { - // Withdrawals reduce the profit remaining in the account - const totalWithdrawals = fundTransactions - .filter((f) => f.amount < 0) - .reduce((s, f) => s + f.amount, 0); // negative sum - const remainingProfit = priorProfit + totalWithdrawals; - return { profitTarget: Math.max(0, profitTarget - remainingProfit), consistency, minTradingDays }; + // Simple Mode A: effective target = profitTarget - equityProfit, computed in computeDailyTarget. + // Since computeDailyTarget already compares (amount - accountSize) against profitTarget, + // no adjustment needed here — just return the base values. + return { profitTarget, consistency, minTradingDays }; } if (withdrawalStages.length > 0) { const withdrawalCount = fundTransactions.filter((f) => f.amount < 0).length;