Last stand: measured against the full daily loss, not the stop after its reserve

The rule is: when hitting the day's loss limit would leave the account 15%
of that loss or less above its max-drawdown floor, ride without a
daily-loss stop. It had compared against the stop-out after the 10%
reserve, which made it stricter — $3,294.70 to the floor with $3,000 of
daily room (9.8% left) wasn't a last stand, and now is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-09-27 13:43:07 -05:00
co-authored by Claude Opus 5.5
parent ff9b107452
commit 5a4e85cc18
4 changed files with 25 additions and 21 deletions
+11 -11
View File
@@ -1242,23 +1242,23 @@ export function maxLossRoom(o: { balance: number; accountSize: number; maxLoss:
return floors.length > 0 ? round2(o.balance - Math.max(...floors)) : null;
}
/** A daily-loss stop is kept only while a stop-out would leave at least this
* share of its loss above the max-drawdown floor. */
/** A daily-loss stop is kept only while the max-drawdown floor lies more than
* this share of a full daily loss beyond it. */
export const LAST_STAND_FRACTION = 0.15;
/**
* Whether a leg should ride without its daily-loss stop. The stop is there to
* keep the account alive for another day; when a stop-out would leave it
* within 15% of that loss of its max-drawdown floor — or the floor is nearer
* than the stop — there is no useful day after, and the stop only gives up
* room (the reserve, and whatever the floor allows past it) for nothing. The
* leg then runs until its take-profit or the firm's own breach.
* keep the account alive for another day; when hitting the day's loss limit
* would leave it within 15% of that loss of its max-drawdown floor — or the
* floor is nearer than the limit — there is no useful day after, and the stop
* only gives up room (the reserve, and whatever the floor allows past it)
* for nothing. The leg then runs until its take-profit or the firm's own
* breach. E.g. $3,000 of daily room with $3,294.70 to the floor: $294.70
* left, 9.8% — a last stand.
*/
export function lastStand(o: { dllRoom: number; dailyLossLimit: number; maxLossRoom: number | null }): boolean {
if (o.maxLossRoom === null || !(o.dailyLossLimit > 0) || !Number.isFinite(o.dllRoom)) return false;
const stopOut = o.dllRoom - DLL_RESERVE_FRACTION * o.dailyLossLimit;
if (!(stopOut > 0)) return false;
return o.maxLossRoom - stopOut <= LAST_STAND_FRACTION * stopOut;
if (o.maxLossRoom === null || !(o.dailyLossLimit > 0) || !Number.isFinite(o.dllRoom) || !(o.dllRoom > 0)) return false;
return o.maxLossRoom - o.dllRoom <= LAST_STAND_FRACTION * o.dllRoom;
}
/** On a last stand: how far price can move against the leg before the firm's