Hello everyone,

I need to use the average true range of the last ninety days for around 150 stocks in my algorithm. I'm doing it this way at the moment:

'in Initialize:'
self.equity_symbols = [
"AAPL", "FB", "TSLA", "AMD", "AMZN", "BABA", "BAC", "BYND", "MSFT", "NFLX", "MU", "NVDA", "SNAP", "GE", "DIS", "T", "BA", "ROKU", "UBER", "NIO",
"CRM", "INTC", "X", "TWTR", "QCOM", "CSCO", "JPM", "CZR", "WDC", "JD", "GOOGL", "TEVA", "F", "WMT", "PCG", "C", "SQ", "FCX", "ADBE", "LYFT", "CGC",
"ORCL", "OXY", "V", "PFE", "QSR", "S", "VZ", "LULU", "AVGO", "BMY", "MPC", "BB", "WFC", "CVS", "IQ", "BX", "BIDU", "GOLD", "KO", "SBUX", "ABBV", "ACB",
"PYPL", "CNC", "TWLO", "CRON", "FDX", "UNH", "NKE", "CMG", "MRK", "TLRY", "HAL", "GM", "HD", "GS", "SHOP", "GOOG", "CHK", "XOM", "MA", "AAL", "CAT",
"PBR", "RIG", "ZM", "CLF", "M", "WYNN", "JNJ", "KR", "IBM", "DISH", "MO", "TGT", "DELL", "DBX", "COST", "CMCSA", "KHC", "PG", "BHC", "EA", "OSTK",
"SLB", "TRP", "JCI", "LVS", "AMAT", "MCD", "CVX", "CELG", "TTD", "AGN", "QD", "DOCU", "CLDR", "BCE", "LEN", "EBAY", "GME", "APC", "DAL", "XLNX",
"AMGN", "AMRN", "NEM", "ATVI", "WBA", "OKTA", "KMI", "CTL", "SFIX", "LNG", "BP", "MDR", "GILD", "STZ", "UPS", "AXP", "GRUB", "BNS",
"HOME", "PWR", "NOK", "UNP", "ACN", "APA", "DHI"
self.high = dict()
self.low = dict()
self.atr = dict()
history = self.History(self.equity_symbols, 90, Resolution.Daily)
history = history.sort_values(by=["symbol", "high"], ascending=[1,0])
for ticker in self.equity_symbols:
self.high[ticker] = history.loc[ticker]["high"][0]
history = history.sort_values(by=["symbol", "low"], ascending=[1,1])
for ticker in self.equity_symbols:
self.low[ticker] = history.loc[ticker]["low"][0]
self.atr[self.Symbol(ticker)] = self.high[ticker] - self.low[ticker]

This is working fine in backtesting but in live trading the server can't handle it and I get the "Algorithm took longer than 10 minutes on a single time loop" error. I think it might be more efficient to use an indicator even if I only need the values once and not being updated. How to do this?

Best regards,