GetData Function

Author: Optuma Team Last updated: Feb 11, 2020 02:38

The GETDATA() function can be used to retrieve data for a security different from the chart displayed on the screen.

Here’s an example using the custom bar colour scheme to colour the bars of the S&P500 index red when the VIX volatility index is above its 22 day moving average. The GetData function is used to retrieve the data for the VIX (variable V1) and then V1 is nested in a moving average function MA() (note: VIX data requires access to the CBOE Index exchange):

V1 > MA(V1, BARS=22, CALC=Close)

Custom Bar Colour Scheme

Click on the GETDATA text in the script editor window and type the required symbol in the Code property and select it from the list:

GetData Properties

Here’s a variation of the above which could be used on a Show Bar or Signal Test on the SPX signalling when the VIX crosses above 20:

V1 CrossesAbove 20

GetData Example