【问题标题】:Average True Range - Google Sheets平均真实范围 - Google 表格
【发布时间】:2017-08-01 18:02:51
【问题描述】:

我从 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))&")")))))

【问题讨论】:

  • 你明白了吗?由于检索结果所花费的时间,它似乎只给出了这个错误。
  • 嗨,不,我还没弄明白。这个想法是找到一种方法来规范化 ATR。决定使用ATR(14)/100

标签: google-sheets google-sheets-query


【解决方案1】:

这是有效的

=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-04-02
    • 2021-05-16
    • 2021-06-17
    • 1970-01-01
    • 2021-10-13
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    相关资源
    最近更新 更多