Skip to content

Security() Function

By Optuma Team · Updated 2020-08-16

When you have a number of tools applied to the chart, and tools applied to other tools, it can be difficult to ensure that a tool is basing its calculations off of the chart data, and not another indicator or overlay.

The SECURITY() function is designed to help in these situations by returning the primary security data of the chart. This is useful when (for example) applying a ShowBar, ShowView or ShowPlot on a tool or an overlay plot. (eg. applying a Show Bar on a Volume tool) but wanting the scripts to use the charts data.

In this example…

Close() > MA()

SEC1

The Show View (shaded green zones) the Close() is actually using the volume and the MA() is the average of the volume. If you were wanting to show the charts close being higher than the MA but have the result displayed within the volume window, you can now use the following script:

// Using Security() to access directly to the chart data.
Data1 = Security();
// This returns positive signal when the Close price is greater than the average of the chart.
Close(Data1) > MA(Data1)

This will ensure the data is coming from the chart, not the volume.

SEC2

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.