Skip to content

TIMEFRAME function

By Optuma Team · Updated 2022-03-15

Available from Optuma 2.0 and onward, the TIMEFRAME() script function allows you to check the source of the dataset being used. This can be useful if wanting to setup scripts that have two different outputs, which you want to control based on the time frame they are applied to.

V1 = MA(BARS=10) ;
V2 = MA(BARS=150, STYLE=Exponential, CALC=Close) ;
V3 = TIMEFRAME() == Day;
IF(V3 == 1,V2,V1)
In the above example the script would display a 150EMA if the charts time frame was set to Daily, and a 10SMA if the charts time frame was set to anything else (weekly, monthly, etc).

Timeframe1
Show Plot using the same script applied to a Daily (left) and Weekly (right) chart. The left plot displays a 150EMA, the right a 10SMA.

The Timeframe function also supports a numerical key system as per the following:

  • Minute Timeframe = 1
  • Daily Timeframe = 2
  • Weekly Timeframe = 3
  • Monthly Timeframe = 4
  • Yearly Timeframe = 5

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.