Skip to content

feat(security): LTF input-passthrough when req >= input AND req < script_tf#4

Merged
luisleo526 merged 2 commits into
mainfrom
feat/ltf-input-passthrough
May 11, 2026
Merged

feat(security): LTF input-passthrough when req >= input AND req < script_tf#4
luisleo526 merged 2 commits into
mainfrom
feat/ltf-input-passthrough

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Summary

  • request.security_lower_tf previously rejected requests where requested TF was >= input TF, even when finer than script TF. Pine returns the real underlying input bars in that range; the engine now does too.
  • New SecurityEvalState fields (lower_tf_use_input, lower_tf_input_aggregation_ratio, lower_tf_input_buffer) buffer raw input bars per state and dispatch one evaluate_security per resulting LTF bar at script-TF chunk completion. OHLCV roll-up when req > input.
  • Validation in validate_security_timeframes accepts the new range (req >= input, req < script_tf, integer divisor of script TF, integer multiple of input TF) and continues to reject other cases with precise messages.
  • Synthesis path (req < input_tf) and HTF path unchanged.

Test plan

  • ctest: 22/22 pass (was 21; new test_security_lower_tf_input_passthrough covers raw passthrough, aggregated passthrough, req==script reject, synthesis fallthrough, non-divisor reject)
  • Corpus parity: 168/197 excellent. lower-tf-probe-02-bool-array on 1m flips from NO_ENGINE_TRADES to excellent (3116/3116 trades, 0% diff). 15m baseline (lower-tf-probe-01) maintained at excellent 819/819.

request.security_lower_tf previously rejected requests where the requested
TF was coarser than the chart's input TF, even when finer than the script
TF. Pine semantics require returning the real underlying input bars in
that range (raw when req == input_tf, OHLCV-rolled when input_tf < req <
script_tf).

Adds lower_tf_use_input + lower_tf_input_aggregation_ratio to
SecurityEvalState, accepts the case in validate_security_timeframes (with
divisor checks against both input and script TF), and dispatches one
evaluate_security per resulting LTF bar from feed_security_eval_state's
per-state input buffer.
Five cases driving the new path: req == input (raw passthrough), req
between input and script (aggregated), req == script (rejected), req <
input (synthesis fallthrough), req not divisor of script (rejected).
@luisleo526 luisleo526 merged commit 7064af1 into main May 11, 2026
4 checks passed
@luisleo526 luisleo526 deleted the feat/ltf-input-passthrough branch May 11, 2026 14:14
luisleo526 added a commit that referenced this pull request May 11, 2026
…le by req

The LTF input-passthrough path added in PR #4 already gated requested-TF
> script-TF and script-TF % requested != 0, but the diagnostic wording
("is not finer than" / "is not an integer divisor") was inconsistent
with the rest of the validate_security_timeframes() error matrix and
read awkwardly to consumers. Rephrase to imperative form ("must be
finer than" / "must evenly divide") so the surface text matches what
the probe corpus and downstream tooling assert against, and so a
caller reading the error knows what to FIX rather than just what
WENT WRONG.

The control-flow checks themselves are unchanged. Update the existing
test_security_lower_tf_input_passthrough assertions to match the new
wording.
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