Timeframe Overrides

Author: Optuma Team Last updated: Apr 3, 2020 05:23


An Optuma script will use the same time frame as the underlying chart it is applied to. ie If the chart is a daily chart and you apply a Show View tool using a script, that script will use Daily data in its calculations.

However, there are a number of time frame override functions available in scripting which allow you to have the script use a different time frame to the chart.

For example you could plot a Weekly Moving Average on a Daily chart with time frame overrides.

The available time frames are:

  • Day()
  • Week()
  • Month()
  • Year()
  • Minute()

For more information please refer to Lecture 3 of the Intermediate Scripting course, available here.


The underlying chart is Daily, but you wish to display the monthly average volume on a Show View chart.


You can see in the example above the chart has a bar for each day, but the Show Views value only changes once per month.

Bar By Bar

The Timeframe override functions have a new property called Bar by Bar. This option allows the script to recalculate each date using the latest available data (at the time), rather than waiting for the last day of the Week / Month / Year. This will better allow for testing setups which include multiple scripts with varying time frames.

In the following example, there are two Show Views applied. The same script is used across both tools, except the lowest Show View has the Bar by Bar property enabled…


You can see without the property enabled the Show View only updates the value once per week (using Fridays data). The Show View where Bar by Bar is enabled recalculates each day to show the Weekly value as it was on that day before the weekly data had finished building.

This function is not compatible with Swing scripts.

For more information on why this property was added in Optuma, please refer to the following Blog Article: