Environment
- PineTS 0.9.28, Node v25.9.0, chart timeframe "1" (1-minute), plain OHLC candles.
Minimal reproduction (chart TF = 1m, so the requested "5" is higher, i.e. invalid for LTF)
//@version=6
indicator("repro")
[h, l, t] = request.security_lower_tf(syminfo.tickerid, "5", [high, low, time], ignore_invalid_timeframe = true)
plot(array.size(h))
Observed
Cannot read properties of undefined (reading 'size')
Expected
With ignore_invalid_timeframe = true, TradingView returns empty arrays — the script's
own array.size(...) == 0 guards then work. It must not throw.
Analysis (from the published source map)
security_lower_tf.ts (~line 327): if (reqTimeframeIdx > ctxTimeframeIdx) { if (_ignore_invalid_timeframe) return NaN; ... } — a scalar NaN where the tuple contract
requires the nested-array shape produced by the function's own same-timeframe branch a
few lines below. The transpiled destructure then yields undefined for each element and
the first array.* consumer throws.
Suggested fix
Return the same shape as the same-timeframe branch but with empty PineArrayObjects
(one per requested tuple element) — Pine-faithful, and lets user guards fire.
Environment
Minimal reproduction (chart TF = 1m, so the requested "5" is higher, i.e. invalid for LTF)
Observed
Expected
With
ignore_invalid_timeframe = true, TradingView returns empty arrays — the script'sown
array.size(...) == 0guards then work. It must not throw.Analysis (from the published source map)
security_lower_tf.ts(~line 327):if (reqTimeframeIdx > ctxTimeframeIdx) { if (_ignore_invalid_timeframe) return NaN; ... }— a scalar NaN where the tuple contractrequires the nested-array shape produced by the function's own same-timeframe branch a
few lines below. The transpiled destructure then yields
undefinedfor each element andthe first
array.*consumer throws.Suggested fix
Return the same shape as the same-timeframe branch but with empty
PineArrayObjects(one per requested tuple element) — Pine-faithful, and lets user guards fire.