Does Deephaven have a built-in ATR (average true range)?
No, Deephaven does not have a built-in ATR (average true range) operation. However, you can accomplish this using aggregations and update_by, such as in the code below.
The first code block sets up a table of open, high, low, and close (OHLC) prices per day as a preliminary step.
Get some sample data
Now, we calculate the ATR for each symbol using a 14-day rolling average. The true range (TR) for each day is the maximum of the high minus the low, the absolute value of the high minus the prior close, and the absolute value of the low minus the prior close. The ATR is the simple rolling average of TR over the last 14 business days.
Note
Wilder's original ATR uses an exponentially smoothed average rather than a simple moving average. The example below uses a simple rolling average for simplicity.