The TIMEFRAME function in ProScreener, part of the ProRealTime trading platform, allows users to specify the time period for which the screening conditions should be evaluated. This function is crucial for traders who need to analyze multiple timeframes simultaneously to make informed decisions based on various technical indicators across different periods.
TIMEFRAME(time_period)
Purpose:
The TIMEFRAME function is used to set the temporal context for the calculations of indicators and conditions within a screener script. By default, screeners run on the current timeframe of the chart. However, with TIMEFRAME, you can override this to check conditions on different timeframes without changing the chart itself.
Consider a scenario where you want to screen stocks that are showing a bullish MACD crossover on a weekly timeframe, but are currently oversold on a daily timeframe based on the Stochastic indicator.
REM Define MACD on a weekly timeframe
TIMEFRAME(weekly)
weeklyMACD = MACD[12,26,9](Close)
bullishCrossover = weeklyMACD crosses over weeklyMACD[1]
REM Define Stochastic on a daily timeframe
TIMEFRAME(daily)
dailySto = Stochastic[14,3](Close)
oversold = dailySto < 30
REM Screener criteria
SCREENER[bullishCrossover AND oversold]
When using the TIMEFRAME function, it's important to remember that each TIMEFRAME call affects all lines of code that follow it until another TIMEFRAME call is made. This allows for complex conditions involving multiple timeframes to be easily scripted and evaluated.
Understanding and utilizing the TIMEFRAME function can significantly enhance the flexibility and depth of your market analysis, allowing for more nuanced and sophisticated trading strategies.