'How to make more than 40 security() calls?
I know the maximum number of security() calls in pinescript is 40 but I came across following workaround from pinecoder.com :
The limit for security() calls is 40, but by using functions returning tuples with security(), you can fetch many more values than 40.
I don't exactly get what the workaround is! I would appreciate if someone can describe it with and example for me.
Solution 1:[1]
Fetching 7 datapoints with one security()
call, by using tuples.
//@version=4
study("Test", "Test", true)
// Fetching 7 datapoints with one security() call.
[o,h,l,c,h2,h3,h4] = security(syminfo.ticker, timeframe.period, [open,high,low,close,hl2,hlc3,ohlc4])
plot( o, "open", color.red)
plot( h, "high", color.green)
plot( l, "low", color.blue)
plot( c, "close", color.fuchsia)
plot(h2, "hl2", color.lime)
plot(h3, "hlc3", color.maroon)
plot(h4, "ohlc4", color.orange)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bjorn Mistiaen |