Tuple Support for the Security Function in Pine Script

May 22, 2020

We’re excited to announce some new changes made to the security function in Pine script. Now you can specify not only series data, but also tuple data for the expression parameter.

Tuple is an unchangeable sequence of values. You can find out more about tuple data here.

Below is an example of tuple data:

//@version=4

study("My Script")

f() => [open, high]

[o, h] = security(syminfo.tickerid, "D", f())

[l, c] = security(syminfo.tickerid, "D", [low, close])

plot((o + h + l + c) / 4)

Please check out this graphic for a visual representation of the above data:

Look first Then leap

TradingView is built for you, so make sure you're getting the most of our awesome features
Launch Chart