Other timeframes and symbols: request.security
## Other timeframes and symbols: request.security
`request.security(symbol, timeframe, expression, gaps)` runs `expression` on the bars of another timeframe
and/or symbol: `ta.sma(close, 20)` inside it is a 20-bar average of those bars. The script sees the value of
the newest requested bar that has **closed** by the end of the current chart bar, so there is never
look-ahead: an hourly value changes on the chart bar that ends the hour, a daily value once the trading day
has ended (at the 17:00 CT session open). The same rule applies live, so history and live agree. Do not add
`[1]` to the expression to avoid repainting; that would return the bar before the last closed one.
- symbol: "" or syminfo.tickerid for the chart symbol, or a platform symbol such as "NQ", "CL", "GC", "ZN"
("CME_MINI:NQ1!" style also works). Const or input.
- timeframe: "1m" "5m" "15m" "30m" "1h" "2h" "4h" "1D" "1W" "1M" (also "D", "W", "M", "60", "240"); "" = the
chart timeframe. Const or input. Lower timeframes than the chart work too (the last closed one).
- expression: a number, bool or color expression, or a tuple `[a, b]` unpacked with `[x, y] = ...`. It may use
inputs, functions and variables declared once with `=` at the top level (they are recomputed on the
requested bars), but not variables changed with `:=` or `var` (error T091), and no plots.
- Call it at the top level of the script, not inside if/for or functions. Before the data has loaded the value
is na.
```lynt
indicator("Daily levels", overlay=true)
len = input.int(20, "Daily SMA length", minval=1)
[dHigh, dLow] = request.security(syminfo.tickerid, "1D", [high, low])
dSma = request.security(syminfo.tickerid, "1D", ta.sma(close, len))
plot(dHigh, "Previous day high", color=color.teal, style=plot.style_stepline)
plot(dLow, "Previous day low", color=color.clay, style=plot.style_stepline)
plot(dSma, "Daily SMA", color=color.amber)
```