Skip to content

Multi-Timeframe (request)

The request namespace lets you access data from higher timeframes. This enables multi-timeframe (MTF) analysis — for example, using the daily trend to filter entries on a 5-minute chart.

request.timeframe(tf)

Fetch OHLCV data from a different timeframe, forward-filled to match the chart's bar count.

  • tf string — timeframe identifier (e.g. '1H', '4H', 'D', 'W')

Returns { open: Series, high: Series, low: Series, close: Series, volume: Series }

ts
const h1 = request.timeframe('1H')

The returned Series have the same length as the chart data. Each bar holds the value from the most recent completed candle of the requested timeframe, forward-filled until the next one arrives.

Timeframe Strings

StringMeaning
'1m'1 minute
'5m'5 minutes
'15m'15 minutes
'30m'30 minutes
'1H'1 hour
'4H'4 hours
'D'Daily
'W'Weekly

TIP

Request a timeframe higher than the chart's timeframe. Requesting the same or a lower timeframe gives no benefit — the data is identical or less granular.

Using MTF Data

The returned object has five Series, just like the built-in globals:

ts
const daily = request.timeframe('D')

// Current bar's daily close (forward-filled)
const dClose = daily.close

// Apply TA to the higher timeframe
const dailySMA = ta.sma(daily.close, 20)

You can use MTF Series anywhere a regular Series is accepted — in ta.* functions, plot, arithmetic, comparisons, and lookback indexing.

Forward-Fill Behavior

If you're on a 5-minute chart and request '1H':

  • Each 1-hour candle spans twelve 5-minute bars
  • All 12 bars within that hour hold the same 1H OHLCV values
  • When a new 1-hour candle completes, the values update

Bars before the first available MTF candle return NaN.

Example: Daily SMA Filter

Plot the daily 50-SMA on a lower-timeframe chart:

ts
indicator('Daily SMA Overlay', { overlay: true })

const daily = request.timeframe('D')
const dailySMA = ta.sma(daily.close, 50)

plot(dailySMA, 'Daily SMA 50', '#FF9800', { lineWidth: 2 })

Example: MTF Trend Strategy

Use the 1-hour trend to filter 5-minute entries:

ts
strategy('MTF Trend Filter', { overlay: true })

const h1 = request.timeframe('1H')
const h1Trend = ta.ema(h1.close, 20)

const fast = ta.ema(close, 9)
const slow = ta.ema(close, 21)

plot(fast, 'Fast', '#26A69A')
plot(slow, 'Slow', '#EF5350')

// Only take longs when 1H trend is up
if (h1.close > h1Trend && ta.crossover(fast, slow)) {
  strategy.entry('Long', 'long')
}

// Only take shorts when 1H trend is down
if (h1.close < h1Trend && ta.crossunder(fast, slow)) {
  strategy.entry('Short', 'short')
}

Tradify Charts Scripting Documentation