The chart's own timeframe
timeframe.period // string: "5", "60", "D", …
timeframe.multiplier // int: 5, 60, 1, 1, 1
Boolean helpers:
timeframe.isseconds timeframe.isminutes
timeframe.isintraday timeframe.isdaily
timeframe.isweekly timeframe.ismonthly
Comparing timeframes
timeframe.in_seconds("5") == 300
timeframe.in_seconds("D") == 86400
timeframe.in_seconds(tf) converts a timeframe string to seconds, letting you build arithmetic comparisons:
higherTf = "D"
isHigher = timeframe.in_seconds(higherTf) > timeframe.in_seconds(timeframe.period)
Buckets
time(tf)→ the bar's bucket start attf.time_close(tf)→ the bar's bucket close attf.
newDay = ta.change(time("D")) != 0
secondsLeftInHour = (time_close("60") - time) / 1000
See Time.
Chart-timeframe override: indicator(timeframe=…)
Force the whole script to compute at a different resolution regardless of the chart's own:
indicator("Weekly RSI (always)", overlay=false, timeframe="W")
plot(ta.rsi(close, 14), "RSI 14")
- The runtime fetches the chart's higher-timeframe bars once and runs the script on those; the chart's native bars are not seen.
- Pair with
timeframe_gaps=trueto carry the previous value forward on bars where the higher-timeframe hasn't produced a new bar yet.
Fetching from a different timeframe mid-script
Use request.security() when only part of the script needs a different timeframe (e.g. a daily RSI shown on a 5-minute chart).