输入“to”不匹配期待“行尾没有续行”。 PineScript 数组中的 for 循环
我正在尝试开发一个指标来显示我的经纪人中所有股票的历史交易。 我很难尝试删除不匹配的输入“以”期望“行结束而没有行继续”。 我已经使用 checker_ticker 验证检查了以下代码并且工作正常。 每次我尝试使用 for 循环和 array.get 函数来搜索数组时,这种情况都会发生在我身上。 有什么想法如何解决吗?
//@version=5
indicator("Historic Trades", overlay=true)
// open ordr arrays
Ord_ticker = array.new_string(0)
Ord_action = array.new_string(0)
Ord_price = array.new_float(0)
Ord_sh_qty = array.new_float(0)
Ord_exe_date = array.new_int(0)
// Orders
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Buy')
array.push(Ord_price,161.1)
array.push(Ord_sh_qty,10)
array.push(Ord_exe_date,timestamp(2022,01,31,09,30))
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Buy')
array.push(Ord_price,173)
array.push(Ord_sh_qty,10)
array.push(Ord_exe_date,timestamp(2022,02,24,09,30))
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Sell')
array.push(Ord_price,157)
array.push(Ord_sh_qty,20)
array.push(Ord_exe_date,timestamp(2022,03,10,09,30))
check_date = false
check_ticker = false
for i =0 to array.size(Ord_ticker) -1
check_date := (array.get(Ord_exe_date,i) == time )
check_ticker := (array.get(Ord_ticker,i) == syminfo.ticker // <==== adding this line results in the error
if check_date and check_ticker
action = array.get(Ord_action,i)
shares = array.get(Ord_sh_qty,i)
price = array.get(Ord_price,i)
txt_lbl = str.tostring(price,'#.#') + " "+ action +" " +str.tostring(shares,'#')
debug2 = label.new(x=time, y=close+7, text=txt_lbl , xloc=xloc.bar_time, yloc=yloc.price, color=color.rgb(0, 0, 0, 100), style=label.style_label_left, textcolor=color.blue, size=size.normal)
I'm trying to develop an indicator that shows my historic trades for all the tickers in my broker.
I'm having a hard time trying to remove the Mismatched input 'to' expecting 'end of line without line continuation'.
I've checked the following code with this checker_ticker validation and works correctly.
This situation happens to me every time I'm trying to use a for loop with the array.get function to search through the array.
Any ideas how to solve?
//@version=5
indicator("Historic Trades", overlay=true)
// open ordr arrays
Ord_ticker = array.new_string(0)
Ord_action = array.new_string(0)
Ord_price = array.new_float(0)
Ord_sh_qty = array.new_float(0)
Ord_exe_date = array.new_int(0)
// Orders
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Buy')
array.push(Ord_price,161.1)
array.push(Ord_sh_qty,10)
array.push(Ord_exe_date,timestamp(2022,01,31,09,30))
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Buy')
array.push(Ord_price,173)
array.push(Ord_sh_qty,10)
array.push(Ord_exe_date,timestamp(2022,02,24,09,30))
array.push(Ord_ticker,'AAPL')
array.push(Ord_action,'Sell')
array.push(Ord_price,157)
array.push(Ord_sh_qty,20)
array.push(Ord_exe_date,timestamp(2022,03,10,09,30))
check_date = false
check_ticker = false
for i =0 to array.size(Ord_ticker) -1
check_date := (array.get(Ord_exe_date,i) == time )
check_ticker := (array.get(Ord_ticker,i) == syminfo.ticker // <==== adding this line results in the error
if check_date and check_ticker
action = array.get(Ord_action,i)
shares = array.get(Ord_sh_qty,i)
price = array.get(Ord_price,i)
txt_lbl = str.tostring(price,'#.#') + " "+ action +" " +str.tostring(shares,'#')
debug2 = label.new(x=time, y=close+7, text=txt_lbl , xloc=xloc.bar_time, yloc=yloc.price, color=color.rgb(0, 0, 0, 100), style=label.style_label_left, textcolor=color.blue, size=size.normal)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在该行上缺少右括号,或者更确切地说,该行上的 array.get 左侧不需要左括号
** 编辑 **
You're missing a right parentheses on that line, or rather do not need a open parentheses to the left of array.get on that line
** EDIT **