Skip to content

fix(codegen): resolve input-derived TA lengths and input.timeframe request.security tf#29

Merged
luisleo526 merged 1 commit into
mainfrom
fix/input-derived-ta-length-and-security-tf
Jun 29, 2026
Merged

fix(codegen): resolve input-derived TA lengths and input.timeframe request.security tf#29
luisleo526 merged 1 commit into
mainfrom
fix/input-derived-ta-length-and-security-tf

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

Summary

Two related transpiler resolution gaps where a structural argument derived from an input (not a literal or direct input alias) silently degraded the generated indicator:

  1. Computed/parameter TA lengths → silent period-1. A ta.* length that is arithmetic-of-input (wilderLen = rsiLen*2-1, wp = sf*2-1) or a function parameter (f(src, len) => ta.sma(src, len)) fell back to period 1 (unsmoothed). Now folded to the compile-time value / expanded to the real runtime length expression; genuinely unresolvable lengths raise a guardrail instead of silently emitting 1. Function per-call-site TA clones now get globally-unique member names, so a helper reached via multiple enclosing functions no longer emits duplicate member declarations.
  2. input.timeframe()-backed request.security timeframe → bare/empty. tf = input.timeframe("60") then request.security(sym, tf, …) emitted tf as a bare variable, uninitialized at evaluator-registration time, so the HTF series degraded to the chart timeframe. Now resolved to its runtime input value.

Validation (TradingView deep-backtest, BINANCE:ETHUSDT.P @ 15m)

  • 3commas DCA cohort: tao 0→100%, dual-rsi 0→100%, bb-rsi 23→99%, sol 7→93%.
  • QQE pair: qqe-trend 1.4→99.8%, qqe-channel 18→84%; jayentriken-bbwp 84→88%.
  • Scraped set verify_corpus tiers: excellent+strong 42→57 / 90.

Corpus parity (hard gate) — intact

  • verify_corpus.py --all = 251 excellent / 1 documented TV anomaly, 0 weak/moderate/minimal.
  • Only 2 corpus strategies' generated C++ changes (mtf-htf-confluence-manual-trail, …-static-bracket): both moderate/weak → excellent, realigning codegen with the committed validated output (HEAD had drifted). The other 252 are byte-identical.
  • Full pytest: 1372 passed, 1 skipped (+6 new regression tests). 0 new transpile/compile failures across the scraped set.

🤖 Generated with Claude Code

…quest.security tf

Two related resolution gaps where a structural argument derived from an input
(not a literal or direct input alias) silently degraded:

- TA constructor length that is arithmetic-of-input (e.g. wilderLen = rsiLen*2-1,
  wp = sf*2-1) or a function parameter (f(src, len) => ta.sma(src, len)) fell back
  to period 1, yielding an unsmoothed indicator. Now folded to the compile-time
  value / expanded to the real runtime length expression; genuinely unresolvable
  lengths raise a guardrail instead of silently emitting 1. Function per-call-site
  TA clones get globally-unique member names so a helper reached via multiple
  enclosing functions no longer emits duplicate member declarations.
- request.security timeframe backed by input.timeframe() (tf = input.timeframe("60"))
  was emitted as a bare variable, uninitialized at evaluator-registration time, so
  the HTF series degraded to the chart timeframe. Now resolved to its runtime input
  value.

Validated against TradingView deep-backtest on the scraped strategy set
(BINANCE:ETHUSDT.P @ 15m): recovers the 3commas DCA cohort (tao/dual-rsi 0->100%,
bb-rsi 23->99%, sol 7->93%) and the QQE pair (qqe-trend 1.4->99.8%, qqe-channel
18->84%). Corpus parity intact: verify_corpus --all = 251 excellent / 1 documented
TV anomaly; the only two corpus strategies whose generated C++ changes
(mtf-htf-confluence-manual-trail / -static-bracket) move moderate/weak -> excellent,
realigning codegen with the committed validated output. Full pytest: 1372 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@luisleo526 luisleo526 merged commit 6545234 into main Jun 29, 2026
9 checks passed
@luisleo526 luisleo526 deleted the fix/input-derived-ta-length-and-security-tf branch June 29, 2026 21:44
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