We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does Deephaven have a built-in ATR? No, but you can accomplish with code like:
from deephaven import time_table, agg, updateby from deephaven.calendar import calendar cal = nyse_cal = calendar("USNYSE_EXAMPLE") trades = ( time_table("PT00:00:01", "2024-09-01T00:00 ET") .update([ "Date = formatDate(Timestamp, 'ET')", "Sym = ii%2 == 0 ? `COS` : `SIN`", "Price = ii%2 == 0 ? cos(0.000001*ii) : sin(0.0000001*ii)", ]) .where("cal.isBusinessDay(Date)") ) # See https://www.investopedia.com/terms/a/atr.asp data = ( trades.agg_by([ agg.first("Open=Price"), agg.last("Close=Price"), agg.max_("High=Price"), agg.min_("Low=Price") ], by=["Date", "Sym"]) ) data = ( data .update("PriorBusDay = cal.plusBusinessDays(Date, -1)") .natural_join(data, on=["PriorBusDay=Date", "Sym"], joins="ClosePrior=Close") .where("!isNull(ClosePrior)") .update("TR = max(High-Low, abs(High-ClosePrior), abs(Low-ClosePrior))") .update_by([updateby.rolling_avg_tick("ATR=TR", rev_ticks=14)], by=["Sym"]) )
The text was updated successfully, but these errors were encountered:
margaretkennedy
No branches or pull requests
Does Deephaven have a built-in ATR? No, but you can accomplish with code like:
The text was updated successfully, but these errors were encountered: