I copied the below formula from Google Doc help forums, on how to calculate ATR using Google sheets.
The formula works for number of days below 20, for days above 20 it returns the below error:
"Function ARRAY_ROW parameter 2 has mismatched row size. Expected: 22. Actual: 21"
Could you please help me by fixing the error.
Trading has drawn me into google sheets & excel, and at the moment the below is beyond my skills, I'm still working with IF statements.
$B1 - Ticker Cell
40 - Period (days)
=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))&")")))))
The formula works for number of days below 20, for days above 20 it returns the below error:
"Function ARRAY_ROW parameter 2 has mismatched row size. Expected: 22. Actual: 21"
Could you please help me by fixing the error.
Trading has drawn me into google sheets & excel, and at the moment the below is beyond my skills, I'm still working with IF statements.
$B1 - Ticker Cell
40 - Period (days)
=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))&")")))))