fix(codegen): resolve input-derived TA lengths and input.timeframe request.security tf#29
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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 emitting1. 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.input.timeframe()-backedrequest.securitytimeframe → bare/empty.tf = input.timeframe("60")thenrequest.security(sym, tf, …)emittedtfas 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)
verify_corpustiers: excellent+strong 42→57 / 90.Corpus parity (hard gate) — intact
verify_corpus.py --all= 251 excellent / 1 documented TV anomaly, 0 weak/moderate/minimal.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.🤖 Generated with Claude Code