Skip to content

Gate stop-entry fills at the open under margin; decline insolvent frozen opens cleanly#99

Merged
luisleo526 merged 1 commit into
mainfrom
fix/admission-semantics
Jul 12, 2026
Merged

Gate stop-entry fills at the open under margin; decline insolvent frozen opens cleanly#99
luisleo526 merged 1 commit into
mainfrom
fix/admission-semantics

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Summary

Two probe-pinned admission fixes (batch-4 clean-room TV probes):

KI-62 margin gate. Under active margin simulation TradingView checks every stop-entry fill at the fill moment against the fill bar's open (decline iff qty * open * margin% > available equity, side-symmetric; intrabar extremes ignored) and cancels declined orders outright — arm-once entries die silently while Pine-level reissue revives them, so re-posted shorts fill at the first bar whose open crosses the stop. Pinned at 99.17% on a 6-cell dedicated probe (this branch scores 99.9%, 1,436/1,438); independently cross-confirmed on over-allocated fixed-qty stops by a second probe (canonical 93.8 → 100.0). Declined fills bypass the 1×-long affordability trim; MARKET/LIMIT/RAW/exit orders and margin=0 paths untouched by construction (byte-identical sentinels prove it).

KI-72. A frozen percent-of-equity order sized at non-positive equity slipped past the sizing-equity guard as a negative quantity and opened a corrupt negative-qty position (negative trade rows, blown cumulative PnL, healthy internal sums). Such opens now decline cleanly and symmetrically, with declined-reversal close-legs suppressed via the existing ledger-restore path.

Verification

  • New suites test_margin_stop_admission + test_short_reversal_emission; REDs stash-proven (5 suites RED on base). ctest 98/98.
  • Two expectation flips justified in-test by second-probe evidence (over-allocated stop declines; the LIMIT sibling keeps admit+trim).
  • Corpus 252: 240/11/1 exact. Byte-identical sentinels: lukeborgerding (MARKET+exit-stops under margin), freddycandle/taro $1M, KI-34 set, keepscratch/coof probes, margin=0 activation probe 2,410/2,410.
  • pct=100 cohort (83 slugs): zero DOWNs. Full 412-slug private sweep: 2 up / 0 down (two weak→strong movers at 99.7/99.8 canonical; one anomaly-group slug 72.5 → 100.0).
  • Fresh-context adversarial review: PASS (gate scoping, decline+cancel lifecycle, dust-trim reconciliation, stage-revert completeness all independently verified).

Known unpinned cells (recorded, non-blocking)

  • Over-allocated FIXED-qty stops: evidenced by the second probe, no dedicated probe cell — candidate future probe.
  • Stop-entry reversal admission uses pre-close realized-only equity (theoretical over-decline on profitable reversals) — validated basis, unpinned cell.
  • Frozen qty exactly 0 now declines (was a fill-price refloor path) — extreme edge, zero corpus impact.

🤖 Generated with Claude Code

…zen opens cleanly

Two probe-pinned admission fixes:

KI-62 margin gate: under active margin simulation TradingView checks every
stop-entry fill at the fill moment against the fill bar's OPEN price
(decline iff qty * open * margin% > available equity, side-symmetric,
intrabar extremes ignored) and CANCELS declined orders outright — arm-once
entries die silently while Pine-level reissue revives them, so re-posted
shorts fill at the first bar whose open crosses the stop. Pinned by
pf-probe-ki62-margin-deferral at 99.17% (this branch scores 99.9%,
1,436/1,438); cross-confirmed on over-allocated fixed-qty stops by
pf-probe-ki65-dual-entry-precedence (canonical 93.8 -> 100.0). Declined
fills bypass the one-shot 1x-long affordability trim; MARKET/LIMIT/RAW/exit
orders and margin=0 paths are untouched by construction.

KI-72: a frozen percent-of-equity order sized at non-positive equity
previously slipped past the sizing-equity guard as a negative quantity and
opened a corrupt negative-qty position (negative trade rows, blown
cumulative PnL, healthy internal accounting). Such opens now decline
cleanly and symmetrically, with declined-reversal close-legs suppressed
via the existing ledger-restore path.

Gates: new suites test_margin_stop_admission + test_short_reversal_emission
(REDs stash-proven); ctest 98/98; two expectation flips justified in-test by
the ki65 evidence (over-allocated stop declines; the limit sibling keeps
admit+trim); corpus 252 = 240/11/1 exact; byte-identical sentinels
(lukeborgerding, freddycandle/taro, KI-34 set, keepscratch/coof probes,
margin=0 activation probe 2,410/2,410); pct=100 cohort zero DOWNs; full
412-slug private sweep 2 up / 0 down (waranyutrkm-asian-box weak->strong
99.7, ahtisham weak->strong 99.8; inside-day anomaly 72.5 -> 100.0).

Known unpinned cells (recorded): over-allocated FIXED-qty stops (ki65-
evidenced, no dedicated probe cell); stop-entry reversal admission uses
pre-close realized-only equity (theoretical over-decline on profitable
reversals); frozen qty exactly 0 declines (was fill-price refloor).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit 9e460d6 into main Jul 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant