ProScreener/proscreener

TIMEFRAME (PS)

TIMEFRAME in ProScreener sets the timeframe used by all following lines of code, enabling screens that combine daily, weekly, and intraday conditions.

Syntax

probuilder
TIMEFRAME(time_period)

Parameters

NameTypeDescription
time_periodkeywordThe timeframe applied to subsequent lines, for example 15 minutes, 1 hour, daily, weekly, or monthly.

How it works

A ProScreener normally evaluates every expression on the timeframe selected in the screener settings. A TIMEFRAME call changes that context, so price constants and indicator calls on the following lines are computed on the new timeframe. The switch stays in effect until another TIMEFRAME call appears, which allows a single screener to mix conditions from several timeframes.

The standard pattern computes each timeframe's conditions into boolean variables, then combines those variables in the final SCREENER call. Variables keep the values they were assigned, regardless of which timeframe was active at assignment time, so a weekly crossover flag can be combined freely with a daily oversold flag.

The keyword is spelled the same as the multi-timeframe instruction used in automated strategies, but the two are separate features. The strategy variant, covered at TIMEFRAME (PB/PO), controls how a running system samples data and supports the UPDATEONCLOSE and DEFAULT modifiers. The ProScreener variant is simpler, it only redirects the data context of subsequent code lines. Code cannot be copied between the two environments without review.

Examples

Example 1, Weekly MACD crossover with daily oversold Stochastic (ProScreener)

probuilder
// Compute MACD on the weekly timeframe
TIMEFRAME(weekly)
weeklyMACD = MACD[12,26,9](Close)
bullishCrossover = weeklyMACD crosses over weeklyMACD[1]

// Compute the Stochastic on the daily timeframe
TIMEFRAME(daily)
dailySto = Stochastic[14,3](Close)
oversold = dailySto < 30

// Combine both timeframes in the screener condition
SCREENER[bullishCrossover AND oversold]

Two indicators are evaluated on different timeframes and merged into one condition. This is the canonical example from the official reference.

Example 2, Weekly trend filter with a daily pullback (ProScreener)

probuilder
// Weekly uptrend qualifier
TIMEFRAME(weekly)
weeklyTrend = close > Average[30](close)

// Daily pullback that holds above the 20-bar average
TIMEFRAME(daily)
dailyMA = Average[20](close)
pullback = low <= dailyMA AND close > dailyMA

SCREENER[weeklyTrend AND pullback](close AS "Close")

Only instruments in a weekly uptrend that dipped to their daily 20-bar average and closed back above it are returned.

Example 3, Intraday volume spike inside a daily uptrend (ProScreener)

probuilder
// Volume spike on the 15-minute timeframe
TIMEFRAME(15 minutes)
volSpike = Volume > 3 * Average[20](Volume)

// Daily trend qualifier
TIMEFRAME(daily)
uptrend = close > Average[50](close)

SCREENER[volSpike AND uptrend](close AS "Last price")

A short-term burst of activity is only reported when the higher timeframe confirms an uptrend, a common way to reduce noise in intraday scans.

Common errors and gotchas

  • The switch persists. Every line after a TIMEFRAME call runs on that timeframe until the next call. A condition written below a weekly block without switching back is silently computed on weekly data, a frequent cause of screens that return too few or wrong results.
  • Not interchangeable with the strategy variant. UPDATEONCLOSE and DEFAULT belong to TIMEFRAME (PB/PO) and are not accepted in ProScreener. Pasting strategy code into a screener fails to compile or behaves differently.
  • Limited history on small timeframes. ProScreener holds a bounded amount of history per timeframe. Deep lookbacks such as Average[200] on a minute timeframe may exceed the available data and prevent the condition from evaluating as expected.
  • Compute before combining. Store each timeframe's result in a variable and combine the variables in the final SCREENER call. Referencing an indicator directly in the screener condition uses whichever timeframe was active last, which is easy to get wrong.
  • TIMEFRAME (PB/PO), the ProBacktest and ProOrder variant of this instruction.
  • SCREENER, defines the filter condition and result column of a screener.
  • EQUITYFRAME, switches a screener to data from another security.
  • MACD, moving average convergence divergence indicator.
  • Stochastic, the %K stochastic oscillator.
  • Average, moving average over a chosen period.
  • EstimatedVolume, projected final volume of the current bar in ProScreener.
  • RSI, relative strength index oscillator.