Custom Code Builder

Author: Optuma Team Last updated: May 24, 2023 10:55


The Custom Code Builder allows you to enter a script formula to generate a range of chart types, from simple spread charts or custom indices, to the more exotic types of charts, such as complex economic models used by the Federal Reserve (see Advanced Formula Custom Codes below).

Once a formula code has been created you can create charts with it just like a normal data file from the Security Selection window (located under the Custom Codes exchange).


This video is pulled from the Optuma 101 course that you can access here. This course takes you through the basics of Optuma and helps you get up and running and using Optuma to its full potential. In this video, Darren Hawkins, MSTA, takes us through how to open, build and edit Custom Codes in Optuma.

The Custom Code Builder also includes an option to set the currency. While this will not change the value of a custom code, what it does allow is for the accurate conversion of the custom code into other currencies.


For example, if you created a custom index for (AAPL + MSFT + V + XOM + FB + CAT) which are all USD codes, you could set the currency of the custom code to USD. When the custom code is opened, it can now be converted to display in other currencies such as AUD, JPY, etc and have the correct conversion factor applied.


Creating a Custom Code

  1. To access the Custom Code Builder go to the Data menu then select Custom Codes.

Custom Code Builder 1

The following window will display.

Custom Code Builder 2

  1. Next, click the New button to start your new Custom Code.

Custom Code Builder 3

  1. In the Script window enter the script that you want to use, e.g AMP+BHP. As you start typing the script the suggested security codes and functions will be displayed below for you to select from.

Custom Code Builder 4

  1. After you enter the script the Code and Name under Properties will be changed automatically based on the script that you have entered. However, you can also left-click on these fields to enter the desired code name.

Custom Code Builder 5

  1. To open the chart select the Open Code button, the chart will then display as a line chart by default.

Custom Code Builder 6

Advanced Formula Custom Codes

The Custom Code can include indicators such as moving averages, or basic scripts to determine a code’s weighting when creating a custom index.

Example 1:

(0.35 * AAPL:US) + (0.25 * MSFT:US) + (0.2 * IBM:US) + (0.2 * YHOO:US)

The above will create a custom weighted index comprised of 35% Apple, 25% Microsoft, and 20% each of IBM and Yahoo.

Example 2:

(((SPX:WI)-(MA(BARS=50, CALC=Close, SPX:WI))) / (MA(BARS=50, CALC=Close, SPX:WI))) * 100

This example will draw a chart based on the percentage difference between the price and 50-period moving average of the S&P500 Index.

Example 3:


For Professional Services users with access to a Bloomberg datafeed, this example will create a chart based on an economic formula used by the Federal Reserve.

Deleting Custom Codes

From the Custom Codes window, roll your mouse over the code you wish to remove, then click the red x.

Custom Code Builder 7