0

我从 Google Doc 帮助论坛复制了以下公式,关于如何使用 Google 表格计算 ATR。该公式适用于 20 天以下的天数,对于 20 天以上的天数,它会返回以下错误:

函数 ARRAY_ROW 参数 2 的行大小不匹配。预期:22。实际:21。

你能帮我解决这个错误吗?交易已将我吸引到谷歌表格和 Excel 中,目前以下内容超出了我的技能范围,我仍在使用 IF 语句。

论坛链接:https ://productforums.google.com/forum/#!topic/docs/gENldwEI040;context-place=forum/docs

$B1 - 股票代码单元格

40 - 期间(天)

=average(ARRAYFORMULA(query(query(transpose(abs(query({query({Googlefinance($B1,"High",today(),today()-(40)),Googlefinance($B1,"low",today(),today()-(40+6))},"select Col1,Col2,Col4 order by Col1 desc limit "&40&" "),query(Googlefinance($B1,"close",today(),today()- (40+6)),"select Col2 order by Col1 desc limit "&40&" offset 1 label Col2 'closeyest' ")}, "select Col2-Col3, Col2-Col4, Col3-Col4"))), "select max(Col"&join(",max(Col",row(indirect("A1:A"&40))&")")))))
4

1 回答 1

0

这是有效的

=average(ARRAYFORMULA(query(query(transpose(abs(query({query({Googlefinance($B1,"High",today()-(100),today()),
Googlefinance($B1,"low",today()-(100),today())},
"select Col1,Col2,Col4 order by Col1 desc limit "&40&" "), query(Googlefinance($B1,"close",today()-(100),today()),
"select Col2 order by Col1 desc limit "&40&" offset 1 label Col2 'closeyest' ")}, 
"select Col2-Col3, Col2-Col4, Col3-Col4"))), 
"select max(Col"&join(",
max(Col",row(indirect("A1:A"&40))&")")))))
于 2021-05-18T17:36:41.090 回答