The script below displays the rate of change (ROC) for multiple instruments (in this case, four BYBIT alt coins), as well as calculating the average ROC. It works, but I need some help with syntax to enable the functionality within an array (last half of the script). Any assistance would be greatly appreciated! Feel free to use and share!

//@version=5
indicator(title=Multi Instrument Rate Of Change)
numBars = 100
plot(ta.roc(close,numBars),color = color.red,linewidth = 1)

symbol2 = input.symbol(BYBIT:AVAXUSDT.P, title=AVAX)
symbol2Close = request.security(symbol2, timeframe.period, close[1],
lookahead=barmerge.lookahead_on)
plot(ta.roc(symbol2Close,numBars), color=color.orange, title=AVAX)

symbol3 = input.symbol(BYBIT:BTCUSDT.P, title=BTC)
symbol3Close = request.security(symbol3, timeframe.period, close[1],
lookahead=barmerge.lookahead_on)
plot(ta.roc(symbol3Close,numBars), color=color.blue, title=BTC)

symbol4 = input.symbol(BYBIT:DOGEUSDT.P, title=DOGE)
symbol4Close = request.security(symbol4, timeframe.period, close[1],
lookahead=barmerge.lookahead_on)
plot(ta.roc(symbol4Close,numBars), color=color.green, title=DOGE)

symbol5 = input.symbol(BYBIT:ETHUSDT.P, title=ETH)
symbol5Close = request.security(symbol5, timeframe.period, close[1],
lookahead=barmerge.lookahead_on)
plot(ta.roc(symbol5Close,numBars), color=color.yellow, title=ETH)

averageROC = math.avg(ta.roc(close,numBars),ta.roc(symbol2Close,numBars),ta.roc(symbol3Close,numBars),ta.roc(symbol4Close,numBars),ta.roc(symbol5Close,numBars))
plot(averageROC,color=color.white, title=Average)

fastAverage = ta.sma(averageROC, 5)
slowAverage = ta.sma(averageROC, 10)

plot(fastAverage, color=color.aqua,title=Fast MA,linewidth = 3)
plot(slowAverage, color=color.fuchsia,title=Slow MA,linewidth = 3)

// --------------------------------------------------------------------------
// Array (need help to get working)
// --------------------------------------------------------------------------

ia = array.new_string()
array.push(ia,1000000MOGUSDT.P)
array.push(ia,10000SATSUSDT.P)
array.push(ia,10000WENUSDT.P)
array.push(ia,1000BEERUSDT.P)
array.push(ia,AVAXUSDT.P)
array.push(ia,BTCUSDT.P)
array.push(ia,DOGEUSDT.P)
array.push(ia,ETHUSDT.P)

string labelText = ""
for i = 0 to (array.size(ia) == 0 ? na : array.size(ia) - 1)

string name = array.get(ia, i)
string iname = "BYBIT:" + name

// *********************************************************
// The syntax of the lines below is incorrect - please help 
//nextSymbol = input.symbol(iname, title=name)
//nextSymbolClose = request.security(nextSymbol, timeframe.period, close[1],lookahead=barmerge.lookahead_on)
//plot(ta.roc(nextSymbolClose,numBars), color=color.orange, title=name)

// Also need to calculate and display average ROC value of all data in the array
// averageROC = math.avg(ta.roc(close,numBars),ta.roc(symbol2Close,numBars),ta.roc(symbol3Close,numBars),ta.roc(symbol4Close,numBars),ta.roc(symbol5Close,numBars))
// plot(averageROC,color=color.white, title="Average") 
// *********************************************************


// Debug to display all names in array
//labelText += iname + "\n"

// Debug to display all names in array
//label.new(bar_index, high, text = labelText)

arrayspine-scriptpine-script-v5