Cap consistency at profitTarget × consistency
Caps consistencyCap at the largest day the consistency rule would have allowed (profitTarget × consistency). Prevents previous overshoots or losses from expanding future targets beyond what consistency permits. Day 1: min(remaining × consistency, profitTarget × consistency) Day 2+: min(maxDay, profitTarget × consistency) 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
8204cd138b
commit
c589adec91
+11
-6
@@ -125,19 +125,24 @@ export function computeDailyTarget(
|
|||||||
// - 0% or 100%: no constraint
|
// - 0% or 100%: no constraint
|
||||||
// - Day 1 of cycle: max allowed = remaining × consistency
|
// - Day 1 of cycle: max allowed = remaining × consistency
|
||||||
// - Day 2+ of cycle: max allowed = maxDay (keeps consistency ratio stable)
|
// - Day 2+ of cycle: max allowed = maxDay (keeps consistency ratio stable)
|
||||||
|
// Always capped at profitTarget × consistency — the largest day the consistency
|
||||||
|
// rule would have allowed. Prevents a previous overshoot/loss from compounding.
|
||||||
let consistencyCap: number;
|
let consistencyCap: number;
|
||||||
let path: 'first_day' | 'normal_day' | 'reduced_day';
|
let path: 'first_day' | 'normal_day' | 'reduced_day';
|
||||||
|
|
||||||
if (consistency === 0 || consistency >= 1) {
|
if (consistency === 0 || consistency >= 1) {
|
||||||
consistencyCap = Infinity;
|
consistencyCap = Infinity;
|
||||||
path = daysTraded === 0 ? 'first_day' : 'reduced_day';
|
path = daysTraded === 0 ? 'first_day' : 'reduced_day';
|
||||||
} else if (daysTraded === 0) {
|
|
||||||
consistencyCap = remaining * consistency;
|
|
||||||
path = 'first_day';
|
|
||||||
} else {
|
} else {
|
||||||
const maxDay = Math.max(...qualifyingDays.map((d) => d.pnl));
|
const maxConsistencyDay = profitTarget * consistency;
|
||||||
consistencyCap = maxDay;
|
if (daysTraded === 0) {
|
||||||
path = 'normal_day';
|
consistencyCap = Math.min(remaining * consistency, maxConsistencyDay);
|
||||||
|
path = 'first_day';
|
||||||
|
} else {
|
||||||
|
const maxDay = Math.max(...qualifyingDays.map((d) => d.pnl));
|
||||||
|
consistencyCap = Math.min(maxDay, maxConsistencyDay);
|
||||||
|
path = 'normal_day';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Combine caps and apply min-day floor when mandatory days remain.
|
// 4. Combine caps and apply min-day floor when mandatory days remain.
|
||||||
|
|||||||
Reference in New Issue
Block a user