Skip to content

fix(engine): stop retro-arming explicit-zero-offset trails from the carried peak - #148

Merged
luisleo526 merged 2 commits into
mainfrom
ship/trail-retro-arming
Aug 12, 2026
Merged

fix(engine): stop retro-arming explicit-zero-offset trails from the carried peak#148
luisleo526 merged 2 commits into
mainfrom
ship/trail-retro-arming

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

luisleo526 and others added 2 commits August 12, 2026 23:32
…arried peak

An EXPLICIT trail_offset=0 is TV's one-shot exit-at-activation trail: it
fills AT its activation crossing, so it can never survive into a later bar
in the armed state — an armed zero-offset trail is an executed one. The
per-bar ExitTrailState reconstruction nevertheless derived "armed" from the
carried post-entry extreme, so when a strategy re-issues strategy.exit each
bar with trail_points derived from close (level_t = entry ± prevBarClose *
perc, trail_offset = 0), an activation level refreshed from a NEWER close
could drop under a peak set beneath an older, higher level: the stop
retro-armed at that stale peak and the position exited at the next bar's
open (or at the stale level on an against-direction segment) — an exit
TradingView never prints.

Scope the carried-best pre-arming away from explicit-zero-offset trails
only. An OMITTED trail_offset keeps the carried arming even though it
shares the exit-at-activation fill rule: TV treats its activation as
durable order state measured against the position's running extreme —
pinned by corpus bracket-exit-stop-limit-trail-same-bar-01 2025-08-30
08:45 (entry 4392.08, activation 4392.26, entry-bar high 4396.01, first
live bar opens 4392.25 one tick BELOW the level, TV fills at that open,
which only a carried armed state produces; the corpus stays byte-identical
under this change). Offset>0 trails likewise keep the reconstruction.

TV rule for the explicit-zero shape (fitted 219/219 + 147/147 clean
trailing exits on the boztilkiserhan serhan1 WMA scalp / ADX tapes, both
of which pass trail_offset=0 literally): level_t = entry ± prevBarClose *
perc, live from the bar after entry, intrabar cross fills at the level, at
the open when the bar opens past it. Discriminating tape: scalp 2025-04-09
— the engine exited at the 14:15 open 1475.99 off a 1501.03 peak under the
refreshed 1500.98 level, while TV holds to 16:30 @1501.19 (entry +
C[16:15]*1.5%, to the cent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@luisleo526
luisleo526 merged commit a6e46ca into main Aug 12, 2026
7 checks passed
@luisleo526
luisleo526 deleted the ship/trail-retro-arming branch August 12, 2026 15:59
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