Skip to content

fix(engine): TV extrema positional windows + bracket lifecycle on declined reversals + 1x-long entry-fill margin chronology - #150

Merged
luisleo526 merged 3 commits into
mainfrom
ship/triple
Aug 12, 2026
Merged

fix(engine): TV extrema positional windows + bracket lifecycle on declined reversals + 1x-long entry-fill margin chronology#150
luisleo526 merged 3 commits into
mainfrom
ship/triple

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Gate

pr-gate PASS — engine corpus zero regressions, scraped entering excellent+strong >= leaving.

Verdict: /Users/haoliangwen/code/pineforge-lab/pr-gate-verdict.json

🤖 Generated with Claude Code

PineForge Factorial and others added 3 commits August 13, 2026 05:06
…sals

A declined in-position opposite MARKET reversal (the KI-54/KI-72 fill
re-check declines — the tradeless reversal) cancels the live position's
standing PRICED strategy.exit brackets on TradingView. The engine kept
the original bracket live and stop-filled early, forking position state
for days on every tradeless opposite signal.

- KILL: the decline marks the position's standing priced brackets
  dormant — never the "__close__" close/close_all family, never stale
  exits bound to a not-yet-filled entry id (the #147 stale-exit family).
- DORMANT: a dormant bracket stays in the book but never matches a fill
  (classify_order_eligibility Skip in the ordinary kernel; an apply-time
  mirror in the KI-60 COOF kernel, whose candidate set is pre-classified
  before any candidate is applied, so a mid-segment kill is invisible to
  classify there).
- REVIVE-A: a fresh same-(id,from_entry) strategy.exit re-issue replaces
  the dormant bracket wholesale and arms the new call's prices (the
  ordinary replacement path — no new code).
- REVIVE-B: a margin-call partial re-registers the surviving position's
  dormant brackets at their last-armed prices.
- MC-CASCADE: when the margin-call event price already makes a revived
  full-percent default stop marketable, the entire remainder closes at
  that event price through the bracket's id on the slice bar.

Derivation: 162/162 alive-at-breach episodes, 118/118 TV stop-skips,
19/19 revive-B exact-stop fills, 18/18 cascade fills at the event
extreme; tape validation collapses the count mismatch to 0 with the
whole suite green and the corpus byte-identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ll, before same-bar intrabar exits

TradingView evaluates the margin_long=100 opening-affordability check AT
THE ENTRY FILL, chronologically before the same bar's intrabar exits.
The #149 chronology hook (margin_call_slice_before_priced_exit)
deliberately excluded 1x longs — compute_liquidation_price() is na there
— so a same-bar priced exit filled the FULL position first and the
end-of-bar one-shot opening event found the position already reduced or
gone: the "Margin call" trim row (ordinary floor-before-4x restore,
including the sub-lot one-contract fallback, filled at the RAW matched
entry base — a pnl-0 row) was lost, and the equity fork cascaded through
every later default-sized fill.

The hook now routes the 1x-long class to an opening-slice helper that
books the trim with process_margin_call's opening-affordability LONG
branch arithmetic verbatim, then lets the triggering exit close the
reduced remainder. The one-shot event is consumed only when a slice is
actually booked. Unchanged byte-for-byte: bars where no same-bar priced
exit fills (end-of-bar placement), POOC close fills, the scoped SHORT
opening event (end-of-bar plus adverse-retry), the leveraged
adverse-extreme chronology class, and every no-deficit evaluation.

The deficit class: a lot-floored percent=100 reversal admitted on an
uptick inside its floor remainder overshoots post-close equity by
tick*(qty+closed) - remainder (sub-lot -> one-contract fallback); a
commissioned explicit open reaches the same discontinuity through its
entry fee. Tape validation collapses the count mismatch (the pure
cascade family) to 0 with the whole suite green and the corpus
byte-identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@luisleo526
luisleo526 merged commit 76d4dc9 into main Aug 12, 2026
7 checks passed
@luisleo526
luisleo526 deleted the ship/triple branch August 12, 2026 21:17
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