yr = tostring(year,"NSE:X####")
vol3_ticker = ticker+yr
vol3 = security(vol3_ticker, timeframe.period, volume, lookahead=barmerge.lookahead_on)
Error:
Cannot call 'security' with arguments (series[string], string, series[float], lookahead=const bool); available overloads: security(string, string, series[float], const bool, const bool, string) => series[float]; security(string, string, series[integer], const bool, const bool, string) => series[integer]; security(string, string, series[bool], const bool, const bool, string) => series[bool]; security(string, string, series[color], const bool, const bool, string) => series[color]; security(string, string, , const bool, const bool, string) =>
Security's symbol argument accept a constant string.
in that case the
yr
variable will returnNSE:X2020
stringThan you are trying to add a current ticker's string from the pine version 3. In the security argument you define the pine version 4 built-in variable as an argument (
timeframe.period
) - You can't mix the built-in variables from different versions and have to chose on which version of pine you are going to write a script. Define it at the beginning of the script -//@version=4
Current ticker's string in version 4 is
syminfo.ticker
(was justticker
in version 3)When you will build a string with
vol3_ticker = syminfo.ticker+yr
make sure it is in existence in the tradingview's datafeed before forwarding it to the security function.