Skip to content

Continue dual-stop paths after margin declines#110

Merged
luisleo526 merged 1 commit into
mainfrom
agent/continue-dual-stop-path-after-margin-decline
Jul 16, 2026
Merged

Continue dual-stop paths after margin declines#110
luisleo526 merged 1 commit into
mainfrom
agent/continue-dual-stop-path-after-margin-decline

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

What

  • Continue evaluating the later member of an eligible same-bar dual-entry stop path when the path-first stop reaches its trigger but broker margin admission declines it.
  • Keep the behavior narrowly scoped to two unlinked, pure entry stops created while truly flat.
  • Add direct scope tests plus fill-path coverage for admitted, declined, excluded, and ordering cases.

Why

The path resolver previously latched the price-path winner before broker-emulator admission. When that stop was then declined for insufficient margin, the affordable path-later stop was suppressed. TradingView continues along the intrabar path in this case, so the latch produced a missing trade.

Safety boundaries

  • Requires exactly two same-created-bar STOP entry orders from a true-flat evaluation.
  • Excludes OCA groups, mixed MARKET/LIMIT/RAW order books, process-orders-on-close creation, calc-on-order-fills creation, and bar magnifier.
  • Resets the path winner only after the normal risk check passes and the shared admission helper proves margin decline.
  • The later stop still passes all ordinary eligibility, risk, and broker-admission checks; it is never force-filled.

Validation

  • Engine: 107/107 tests passed; focused order/fill suite 49/49 passed.
  • Independent cold review: clean.
  • Community full gate: 412/412 accounted, 1 tier upgrade, 0 downgrades.
    • Waranyu: Strong to Excellent, canonical 369 TV / 369 engine / 369 matched; count abs 0; PnL P90 0.0001.
    • Aht: recovered the missing 2025-12-17 TradingView long and all 481 TV trades now match; it remains Strong because 8 engine-only residual trades remain visible.
  • Corpus: 252/252 successful; 243 Excellent / 8 Strong / 1 anomaly; no tier movement.
  • N=2 attribution gate tested the margin-decline continuation independently and in composition; publication gate passed with all cells complete. The competing frozen-placement-quantity factor was rejected.
  • Used the existing TradingView oracle tapes; no re-export was needed.

Impact

This fixes a broker-emulator ordering defect where one bug could hide another admissible entry. It improves one real strategy without widening global tolerances or concealing the remaining Aht residuals.

@luisleo526 luisleo526 marked this pull request as ready for review July 16, 2026 06:47
@luisleo526 luisleo526 merged commit 0437eb3 into main Jul 16, 2026
5 checks passed
@luisleo526 luisleo526 deleted the agent/continue-dual-stop-path-after-margin-decline branch July 16, 2026 06:50
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