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) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
9c2b2278eb
commit
c0d60dfe8d
@@ -19,12 +19,10 @@ export function resolveEffectiveConfig(
|
|||||||
fundTransactions: { date: string; amount: number }[]
|
fundTransactions: { date: string; amount: number }[]
|
||||||
): { profitTarget: number; consistency: number; minTradingDays: number } {
|
): { profitTarget: number; consistency: number; minTradingDays: number } {
|
||||||
if (targetSameEquity) {
|
if (targetSameEquity) {
|
||||||
// Withdrawals reduce the profit remaining in the account
|
// Simple Mode A: effective target = profitTarget - equityProfit, computed in computeDailyTarget.
|
||||||
const totalWithdrawals = fundTransactions
|
// Since computeDailyTarget already compares (amount - accountSize) against profitTarget,
|
||||||
.filter((f) => f.amount < 0)
|
// no adjustment needed here — just return the base values.
|
||||||
.reduce((s, f) => s + f.amount, 0); // negative sum
|
return { profitTarget, consistency, minTradingDays };
|
||||||
const remainingProfit = priorProfit + totalWithdrawals;
|
|
||||||
return { profitTarget: Math.max(0, profitTarget - remainingProfit), consistency, minTradingDays };
|
|
||||||
}
|
}
|
||||||
if (withdrawalStages.length > 0) {
|
if (withdrawalStages.length > 0) {
|
||||||
const withdrawalCount = fundTransactions.filter((f) => f.amount < 0).length;
|
const withdrawalCount = fundTransactions.filter((f) => f.amount < 0).length;
|
||||||
|
|||||||
Reference in New Issue
Block a user