【发布时间】:2020-05-12 11:33:07
【问题描述】:
我正在尝试在 tradingview 的 pine 脚本中创建一个显示 NEXT AUD 期货合约的脚本。我希望它能够计算出它是哪一年,然后将那一年添加到未来代码的末尾。
例如,今年 6 月 AUD 期货代码 = "6AM2020" 我可以参考这个,但几年后新的未来将是“6AM2021) 因此,为什么我希望脚本不断检查它是哪一年,然后在代码逻辑的末尾添加“找到的年份”。
但我不断收到此错误。
"脚本'TEST - Next AUD future' 已保存 处理脚本...
第 10 行:无法使用参数调用“运算符 +”(常量字符串,系列 [整数]);可用重载:+(const integer, const integer) => const integer; +(常量浮动,常量浮动)=>常量浮动; +(输入整数, 输入整数) => 输入整数; +(输入浮点数,输入浮点数)=> 输入浮点数; +(整数,整数)=>整数; +(浮动,浮动)=>浮动; +(系列[整数],系列[整数])=>系列[整数]; +(series[float], series[float]) => series[float]; +(常量字符串,常量字符串)=>常量字符串; +(输入字符串, 输入字符串) => 输入字符串; +(字符串,字符串)=>字符串; +(系列[字符串],系列[字符串])=>系列[字符串]; +(整数)=> 整数; +(浮动)=>浮动; +(输入整数)=> 输入整数; +(输入浮点数)=> 输入浮点数; +(常量整数)=>常量整数; +(常量浮动)=>常量浮动; +(系列[整数]) => 系列[整数]; +(系列[浮动]) => 系列[浮动]; 第 14 行:未声明的标识符“march_ticker”; 第 18 行:未声明的标识符 'march'
脚本“TEST - Next AUD Future”已保存“
代码-
//@version=4
study(title="Next AUD Future", overlay=true)
// References current bar year
ticker_year = year
// Builds the desired ticker using the correct year as above
june_ticker = ("CME" + ":" + "6AM" + ticker_year)
// Creates a series using the ticker thats built above
june = security(june_ticker, timeframe.period, close, barmerge.gaps_off, barmerge.lookahead_on)
// Plots the series above
plot(june, title="June", color=color.aqua, title='June', linewidth=1, transp=0)
代码-
非常感谢任何帮助。谢谢!
【问题讨论】:
-
不要在多个论坛中问同一个问题。您冒着让不同的志愿者同时帮助您的风险。您的问题已在电视上的 Pine Script 聊天中得到解答。
-
@PineCoders-LucF。是的,谢谢你的帮助。我只是在发布此内容后才发现您的提要。将关闭此线程。
标签: operators operator-keyword pine-script