Skip to content

session symbols: syminfo-tz session windows, symbol-clock D/W/M anchors, zero-lot orders, margin call at the open - #162

Merged
luisleo526 merged 1 commit into
mainfrom
fix/symbol-r5-session-semantics
Aug 24, 2026
Merged

session symbols: syminfo-tz session windows, symbol-clock D/W/M anchors, zero-lot orders, margin call at the open#162
luisleo526 merged 1 commit into
mainfrom
fix/symbol-r5-session-semantics

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Four generic session-symbol semantics fixes, measured on the NASDAQ:AAPL and OANDA:EURUSD 15m populations and byte-inert on BINANCE:ETHUSDT.P (24x7/UTC) — ETH scraped 396/396 and corpus 309/2/1 unchanged.

  1. time(tf, session) / time_close session windows read in syminfo.timezone (finding 421/436). The session-filter tz defaulted to UTC; Pine resolves it in the exchange tz. Engine side: pine_time/pine_time_close gain a trailing syminfo_tz (default "" = old behaviour; feature macro PF_PINE_TIME_HAS_SYMINFO_TZ). Codegen PR passes syminfo_.timezone.
  2. Zero-lot orders are not placed (finding 426/438). An entry or pyramiding add whose lot-floored quantity is 0 was admitted as a phantom qty-0 position (opentrades==1, position_size==0), silently blocking every later signal. TV simply does not place it.
  3. Symbol-clock D/W/M anchors for ta.vwap, timeframe.change, time('D'|'W'|'M') (finding 423/440). These keyed on UTC midnight; for OANDA:EURUSD the trading day rolls 17:00 ET and the week opens Sun 17:00 ET. New helpers (session_day_index, session_period_open_ms/close_ms) built on the security: anchor HTF aggregation on the symbol clock (syminfo.timezone + session) #159security: session-attributed weekly/monthly period keys #161 machinery; VWAP::compute (tz,session) overloads, 7-arg pine_time (macros PF_PINE_TIME_HAS_SESSION_DAY, PF_VWAP_HAS_SESSION_ANCHOR). Semantic decisions pending a TV probe are listed in finding 440 (valid explicit session defines the day in its own tz; wrapped-session month attribution).
  4. Forced liquidation at the bar open for carried leveraged positions (finding 430/441). TV fires the margin-call slice at the OPEN when the open already breaches (then a second slice at the extreme); the engine only checked the extreme. Rule fitted on 8,414 AAPL margin-call events (8,403 qty-exact).

Population evidence (lab findings 443–445; ladder-ranking harness 90fcb64): EURUSD excellent 251 → 271, e+s 327 → 347, 30 tier ups / 0 downs; AAPL excellent 210 → 235, e+s 291 → 307, 31 up / 5 down. Four-lane symbol gate PASS vs the 08-22 baseline (aapl 170 up / 19 down, eurusd 79 up / 36 down).

Tests: ctest green incl. new test_zero_lot_entry_decline, test_session_day_anchors (23,850 checks), test_margin_call_gap_open, session_time DST cases.

@luisleo526
luisleo526 merged commit b1449c3 into main Aug 24, 2026
7 checks passed
@luisleo526
luisleo526 deleted the fix/symbol-r5-session-semantics branch August 24, 2026 17:22
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