Seed Data and Collection Helpers
request.seed, map.*, and matrix.* — real runtime features for deterministic side-channel data, keyed bundles, and 2D calculations.
Seed Data and Collection Helpers#
The current runtime has practical, example-backed coverage for request.seed(...), map.*, and matrix.*. These are still partial parity surfaces compared with Pine, but they are no longer speculative or hidden implementation details.
request.seed#
Use it when the script needs deterministic side-channel data such as inline seeded series, structured local payloads, or reproducible auxiliary values that should remain in the frame-builder stage.
map and matrix#
Use map.* for keyed runtime bundles and matrix.* for compact 2D calculations. The docs site now treats both as supported teaching surfaces, not just footnotes in the capability matrix.
Example#
from source import indicator, input, map, matrix, request
indicator("Runtime Collections Demo", overlay=False)
window = input.int(4, title="Window", key="window", minval=2)
def build_indicator_frame(df, params=None):
frame = df.copy().reset_index(drop=True)
size = max(int((params or {}).get("window", window) or window), 2)
seeded_source = {
"seeded_close": frame["close"].rolling(size, min_periods=1).mean().round(4).tolist(),
}
frame["seeded_close"] = request.seed(seeded_source, "seeded_close")
settings = map.new()
map.put(settings, "window", size)
map.put(settings, "bias", "bullish")
frame.attrs["map_keys"] = map.keys(settings)
grid = matrix.new(size, 2, 0.0)
return frame